diff options
author | 2017-11-06 12:50:14 -0800 | |
---|---|---|
committer | 2017-11-06 12:50:14 -0800 | |
commit | 0be9ad440878b94d9a68f35992c23e7f99375dbc (patch) | |
tree | 9ce37a5e50f1ee47df6d42ef3e44d63160e8d0dc /src/core/lib/iomgr/tcp_client_windows.cc | |
parent | c60659ad023d01f8d0f6ad0f87fefbd3740002d0 (diff) | |
parent | e759d2ad7abdb0702970eeccc5f033ff4b2a4c7f (diff) |
Merge github.com:grpc/grpc into lfe3
Diffstat (limited to 'src/core/lib/iomgr/tcp_client_windows.cc')
-rw-r--r-- | src/core/lib/iomgr/tcp_client_windows.cc | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/src/core/lib/iomgr/tcp_client_windows.cc b/src/core/lib/iomgr/tcp_client_windows.cc index 9adf7ee4e9..103e6b78de 100644 --- a/src/core/lib/iomgr/tcp_client_windows.cc +++ b/src/core/lib/iomgr/tcp_client_windows.cc @@ -40,21 +40,21 @@ #include "src/core/lib/iomgr/timer.h" typedef struct { - grpc_closure *on_done; + grpc_closure* on_done; gpr_mu mu; - grpc_winsocket *socket; + grpc_winsocket* socket; grpc_timer alarm; grpc_closure on_alarm; - char *addr_name; + char* addr_name; int refs; grpc_closure on_connect; - grpc_endpoint **endpoint; - grpc_channel_args *channel_args; + grpc_endpoint** endpoint; + grpc_channel_args* channel_args; } async_connect; -static void async_connect_unlock_and_cleanup(grpc_exec_ctx *exec_ctx, - async_connect *ac, - grpc_winsocket *socket) { +static void async_connect_unlock_and_cleanup(grpc_exec_ctx* exec_ctx, + async_connect* ac, + grpc_winsocket* socket) { int done = (--ac->refs == 0); gpr_mu_unlock(&ac->mu); if (done) { @@ -66,10 +66,10 @@ static void async_connect_unlock_and_cleanup(grpc_exec_ctx *exec_ctx, if (socket != NULL) grpc_winsocket_destroy(socket); } -static void on_alarm(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { - async_connect *ac = (async_connect *)acp; +static void on_alarm(grpc_exec_ctx* exec_ctx, void* acp, grpc_error* error) { + async_connect* ac = (async_connect*)acp; gpr_mu_lock(&ac->mu); - grpc_winsocket *socket = ac->socket; + grpc_winsocket* socket = ac->socket; ac->socket = NULL; if (socket != NULL) { grpc_winsocket_shutdown(socket); @@ -77,16 +77,16 @@ static void on_alarm(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { async_connect_unlock_and_cleanup(exec_ctx, ac, socket); } -static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { - async_connect *ac = (async_connect *)acp; - grpc_endpoint **ep = ac->endpoint; +static void on_connect(grpc_exec_ctx* exec_ctx, void* acp, grpc_error* error) { + async_connect* ac = (async_connect*)acp; + grpc_endpoint** ep = ac->endpoint; GPR_ASSERT(*ep == NULL); - grpc_closure *on_done = ac->on_done; + grpc_closure* on_done = ac->on_done; GRPC_ERROR_REF(error); gpr_mu_lock(&ac->mu); - grpc_winsocket *socket = ac->socket; + grpc_winsocket* socket = ac->socket; ac->socket = NULL; gpr_mu_unlock(&ac->mu); @@ -123,21 +123,21 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { /* Tries to issue one async connection, then schedules both an IOCP notification request for the connection, and one timeout alert. */ static void tcp_client_connect_impl( - grpc_exec_ctx *exec_ctx, grpc_closure *on_done, grpc_endpoint **endpoint, - grpc_pollset_set *interested_parties, const grpc_channel_args *channel_args, - const grpc_resolved_address *addr, grpc_millis deadline) { + grpc_exec_ctx* exec_ctx, grpc_closure* on_done, grpc_endpoint** endpoint, + grpc_pollset_set* interested_parties, const grpc_channel_args* channel_args, + const grpc_resolved_address* addr, grpc_millis deadline) { SOCKET sock = INVALID_SOCKET; BOOL success; int status; grpc_resolved_address addr6_v4mapped; grpc_resolved_address local_address; - async_connect *ac; - grpc_winsocket *socket = NULL; + async_connect* ac; + grpc_winsocket* socket = NULL; LPFN_CONNECTEX ConnectEx; GUID guid = WSAID_CONNECTEX; DWORD ioctl_num_bytes; - grpc_winsocket_callback_info *info; - grpc_error *error = GRPC_ERROR_NONE; + grpc_winsocket_callback_info* info; + grpc_error* error = GRPC_ERROR_NONE; *endpoint = NULL; @@ -172,8 +172,8 @@ static void tcp_client_connect_impl( grpc_sockaddr_make_wildcard6(0, &local_address); - status = bind(sock, (struct sockaddr *)&local_address.addr, - (int)local_address.len); + status = + bind(sock, (struct sockaddr*)&local_address.addr, (int)local_address.len); if (status != 0) { error = GRPC_WSA_ERROR(WSAGetLastError(), "bind"); goto failure; @@ -181,8 +181,8 @@ static void tcp_client_connect_impl( socket = grpc_winsocket_create(sock, "client"); info = &socket->write_info; - success = ConnectEx(sock, (struct sockaddr *)&addr->addr, (int)addr->len, - NULL, 0, NULL, &info->overlapped); + success = ConnectEx(sock, (struct sockaddr*)&addr->addr, (int)addr->len, NULL, + 0, NULL, &info->overlapped); /* It wouldn't be unusual to get a success immediately. But we'll still get an IOCP notification, so let's ignore it. */ @@ -194,7 +194,7 @@ static void tcp_client_connect_impl( } } - ac = (async_connect *)gpr_malloc(sizeof(async_connect)); + ac = (async_connect*)gpr_malloc(sizeof(async_connect)); ac->on_done = on_done; ac->socket = socket; gpr_mu_init(&ac->mu); @@ -211,8 +211,8 @@ static void tcp_client_connect_impl( failure: GPR_ASSERT(error != GRPC_ERROR_NONE); - char *target_uri = grpc_sockaddr_to_uri(addr); - grpc_error *final_error = grpc_error_set_str( + char* target_uri = grpc_sockaddr_to_uri(addr); + grpc_error* final_error = grpc_error_set_str( GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Failed to connect", &error, 1), GRPC_ERROR_STR_TARGET_ADDRESS, grpc_slice_from_copied_string(target_uri)); @@ -228,17 +228,17 @@ failure: // overridden by api_fuzzer.c extern "C" { void (*grpc_tcp_client_connect_impl)( - grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, - grpc_pollset_set *interested_parties, const grpc_channel_args *channel_args, - const grpc_resolved_address *addr, + grpc_exec_ctx* exec_ctx, grpc_closure* closure, grpc_endpoint** ep, + grpc_pollset_set* interested_parties, const grpc_channel_args* channel_args, + const grpc_resolved_address* addr, grpc_millis deadline) = tcp_client_connect_impl; } -void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, - grpc_endpoint **ep, - grpc_pollset_set *interested_parties, - const grpc_channel_args *channel_args, - const grpc_resolved_address *addr, +void grpc_tcp_client_connect(grpc_exec_ctx* exec_ctx, grpc_closure* closure, + grpc_endpoint** ep, + grpc_pollset_set* interested_parties, + const grpc_channel_args* channel_args, + const grpc_resolved_address* addr, grpc_millis deadline) { grpc_tcp_client_connect_impl(exec_ctx, closure, ep, interested_parties, channel_args, addr, deadline); |