Merge pull request #3695 from rjshade/udp_exec_ctx

Fix broken udp_server_test, by adding exec_ctx to read_cb
pull/3700/head
Yang Gao 9 years ago
commit d1da978a84
  1. 2
      src/core/iomgr/udp_server.c
  2. 3
      src/core/iomgr/udp_server.h
  3. 3
      test/core/iomgr/udp_server_test.c

@ -278,7 +278,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *arg, int success) {
/* Tell the registered callback that data is available to read. */ /* Tell the registered callback that data is available to read. */
GPR_ASSERT(sp->read_cb); GPR_ASSERT(sp->read_cb);
sp->read_cb(sp->emfd, sp->server->grpc_server); sp->read_cb(exec_ctx, sp->emfd, sp->server->grpc_server);
/* Re-arm the notification event so we get another chance to read. */ /* Re-arm the notification event so we get another chance to read. */
grpc_fd_notify_on_read(exec_ctx, sp->emfd, &sp->read_closure); grpc_fd_notify_on_read(exec_ctx, sp->emfd, &sp->read_closure);

@ -43,7 +43,8 @@ typedef struct grpc_server grpc_server;
typedef struct grpc_udp_server grpc_udp_server; typedef struct grpc_udp_server grpc_udp_server;
/* Called when data is available to read from the socket. */ /* Called when data is available to read from the socket. */
typedef void (*grpc_udp_server_read_cb)(grpc_fd *emfd, grpc_server *server); typedef void (*grpc_udp_server_read_cb)(grpc_exec_ctx *exec_ctx, grpc_fd *emfd,
grpc_server *server);
/* Create a server, initially not bound to any ports */ /* Create a server, initially not bound to any ports */
grpc_udp_server *grpc_udp_server_create(void); grpc_udp_server *grpc_udp_server_create(void);

@ -49,7 +49,8 @@ static grpc_pollset g_pollset;
static int g_number_of_reads = 0; static int g_number_of_reads = 0;
static int g_number_of_bytes_read = 0; static int g_number_of_bytes_read = 0;
static void on_read(grpc_fd *emfd, grpc_server *server) { static void on_read(grpc_exec_ctx *exec_ctx, grpc_fd *emfd,
grpc_server *server) {
char read_buffer[512]; char read_buffer[512];
ssize_t byte_count; ssize_t byte_count;

Loading…
Cancel
Save