Add completion queue argument which is necessary after merge with master

pull/6610/head
Adam Michalik 9 years ago
parent bf10c82bf8
commit da5d85d660
  1. 7
      include/grpc/grpc_posix.h
  2. 8
      src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c
  3. 2
      test/core/end2end/fixtures/h2_fd.c

@ -60,8 +60,11 @@ GRPCAPI grpc_channel *grpc_insecure_channel_create_from_fd(
/** Add the connected communication channel based on file descriptor 'fd' to the
'server'. The 'fd' must be an open file descriptor corresponding to a
connected socket. */
GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd);
connected socket. The 'cq' is a completion queue that will be getting events
from that descriptor. */
GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
grpc_completion_queue *cq,
int fd);
#endif // GPR_POSIX_SOCKET

@ -44,9 +44,12 @@
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/tcp_posix.h"
#include "src/core/lib/surface/completion_queue.h"
#include "src/core/lib/surface/server.h"
void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd) {
void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
grpc_completion_queue *cq,
int fd) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
char *name;
gpr_asprintf(&name, "fd:%d", fd);
@ -57,7 +60,8 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd) {
const grpc_channel_args *server_args = grpc_server_get_channel_args(server);
grpc_transport *transport = grpc_create_chttp2_transport(
&exec_ctx, server_args, server_endpoint, 0 /* is_client */);
grpc_server_setup_transport(&exec_ctx, server, transport, server_args);
grpc_endpoint_add_to_pollset(&exec_ctx, server_endpoint, grpc_cq_pollset(cq));
grpc_server_setup_transport(&exec_ctx, server, transport, NULL, server_args);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -97,7 +97,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f,
grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_start(f->server);
grpc_server_add_insecure_channel_from_fd(f->server, sfd->fd_pair[1]);
grpc_server_add_insecure_channel_from_fd(f->server, f->cq, sfd->fd_pair[1]);
grpc_exec_ctx_finish(&exec_ctx);
}

Loading…
Cancel
Save