aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/grpc/grpc_posix.h7
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c8
-rw-r--r--test/core/end2end/fixtures/h2_fd.c2
3 files changed, 12 insertions, 5 deletions
diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h
index b72ea5208d..509e51e2c4 100644
--- a/include/grpc/grpc_posix.h
+++ b/include/grpc/grpc_posix.h
@@ -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
diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c
index 1946f394d4..1807efc85d 100644
--- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c
+++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c
@@ -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);
}
diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c
index b162cf8248..7079080722 100644
--- a/test/core/end2end/fixtures/h2_fd.c
+++ b/test/core/end2end/fixtures/h2_fd.c
@@ -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);
}