|
|
|
@ -50,10 +50,10 @@ |
|
|
|
|
#include "src/core/lib/surface/server.h" |
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
void *reserved, int fd) { |
|
|
|
|
GPR_ASSERT(reserved == NULL); |
|
|
|
|
|
|
|
|
|
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
|
|
|
|
char *name; |
|
|
|
|
gpr_asprintf(&name, "fd:%d", fd); |
|
|
|
|
|
|
|
|
@ -65,7 +65,15 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, |
|
|
|
|
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_endpoint_add_to_pollset(&exec_ctx, server_endpoint, grpc_cq_pollset(cq)); |
|
|
|
|
|
|
|
|
|
grpc_pollset **pollsets; |
|
|
|
|
size_t num_pollsets = 0; |
|
|
|
|
grpc_server_get_pollsets(server, &pollsets, &num_pollsets); |
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < num_pollsets; i++) { |
|
|
|
|
grpc_endpoint_add_to_pollset(&exec_ctx, server_endpoint, pollsets[i]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_server_setup_transport(&exec_ctx, server, transport, NULL, server_args); |
|
|
|
|
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); |
|
|
|
|
grpc_exec_ctx_finish(&exec_ctx); |
|
|
|
@ -74,8 +82,7 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, |
|
|
|
|
#else // !GPR_SUPPORT_CHANNELS_FROM_FD
|
|
|
|
|
|
|
|
|
|
void grpc_server_add_insecure_channel_from_fd(grpc_server *server, |
|
|
|
|
grpc_completion_queue *cq, |
|
|
|
|
int fd) { |
|
|
|
|
void *reserved, int fd) { |
|
|
|
|
GPR_ASSERT(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|