|
|
|
@ -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); |
|
|
|
|
} |
|
|
|
|