aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/iomgr/tcp_server_windows.c
diff options
context:
space:
mode:
authorGravatar Robbie Shade <rjshade@google.com>2015-08-28 14:30:35 -0400
committerGravatar Robbie Shade <rjshade@google.com>2015-08-28 14:30:35 -0400
commit3cd2d18e0f50dea70e3fdbfa27e7b0e7bb1a2244 (patch)
tree46a7d7fefd936dcb65c3a95ea38a57f122f4c424 /src/core/iomgr/tcp_server_windows.c
parent9b1f91e7eac88ba477871a60912cc3b6ed3380ed (diff)
Rename the TCP server callback arguments to be more descriptive.
Diffstat (limited to 'src/core/iomgr/tcp_server_windows.c')
-rw-r--r--src/core/iomgr/tcp_server_windows.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c
index d0478d3604..b30ab768c6 100644
--- a/src/core/iomgr/tcp_server_windows.c
+++ b/src/core/iomgr/tcp_server_windows.c
@@ -71,8 +71,9 @@ typedef struct server_port {
/* the overall server */
struct grpc_tcp_server {
- grpc_tcp_server_cb cb;
- void *cb_arg;
+ /* Called whenever accept() succeeds on a server port. */
+ grpc_tcp_server_cb on_accept_cb;
+ void *on_accept_cb_arg;
gpr_mu mu;
gpr_cv cv;
@@ -97,8 +98,8 @@ grpc_tcp_server *grpc_tcp_server_create(void) {
gpr_cv_init(&s->cv);
s->active_ports = 0;
s->iomgr_callbacks_pending = 0;
- s->cb = NULL;
- s->cb_arg = NULL;
+ s->on_accept_cb = NULL;
+ s->on_accept_cb_arg = NULL;
s->ports = gpr_malloc(sizeof(server_port) * INIT_PORT_CAP);
s->nports = 0;
s->port_capacity = INIT_PORT_CAP;
@@ -334,7 +335,7 @@ static void on_accept(void *arg, int from_iocp) {
/* The only time we should call our callback, is where we successfully
managed to accept a connection, and created an endpoint. */
- if (ep) sp->server->cb(sp->server->cb_arg, ep);
+ if (ep) sp->server->on_accept_cb(sp->server->cb_arg, ep);
/* As we were notified from the IOCP of one and exactly one accept,
the former socked we created has now either been destroy or assigned
to the new connection. We need to create a new one for the next
@@ -370,7 +371,7 @@ static int add_socket_to_server(grpc_tcp_server *s, SOCKET sock,
port = prepare_socket(sock, addr, addr_len);
if (port >= 0) {
gpr_mu_lock(&s->mu);
- GPR_ASSERT(!s->cb && "must add ports before starting server");
+ GPR_ASSERT(!s->on_accept_cb && "must add ports before starting server");
/* append it to the list under a lock */
if (s->nports == s->port_capacity) {
s->port_capacity *= 2;
@@ -452,15 +453,16 @@ SOCKET grpc_tcp_server_get_socket(grpc_tcp_server *s, unsigned index) {
}
void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset **pollset,
- size_t pollset_count, grpc_tcp_server_cb cb,
- void *cb_arg) {
+ size_t pollset_count,
+ grpc_tcp_server_cb on_accept_cb,
+ void *on_accept_cb_arg) {
size_t i;
- GPR_ASSERT(cb);
+ GPR_ASSERT(on_accept_cb);
gpr_mu_lock(&s->mu);
- GPR_ASSERT(!s->cb);
+ GPR_ASSERT(!s->on_accept_cb);
GPR_ASSERT(s->active_ports == 0);
- s->cb = cb;
- s->cb_arg = cb_arg;
+ s->on_accept_cb = on_accept_cb;
+ s->on_accept_cb_arg = on_accept_cb_arg;
for (i = 0; i < s->nports; i++) {
s->ports[i].socket->read_info.outstanding = 1;
start_accept(s->ports + i);