This is an automated email from the ASF dual-hosted git repository. cliffjansen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/master by this push: new 85726a4 PROTON-2081: Hang in Windows proactor during connect - thread race 85726a4 is described below commit 85726a4539a037fd2965f91748d0c8ae4d3d90a3 Author: Cliff Jansen <cliffjan...@apache.org> AuthorDate: Mon Jul 29 10:06:48 2019 -0700 PROTON-2081: Hang in Windows proactor during connect - thread race --- c/src/proactor/win_iocp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/c/src/proactor/win_iocp.c b/c/src/proactor/win_iocp.c index 429f6e1..d4951d0 100644 --- a/c/src/proactor/win_iocp.c +++ b/c/src/proactor/win_iocp.c @@ -2656,15 +2656,19 @@ static bool connect_step(pconnection_t *pc) { LPFN_CONNECTEX fn_connect_ex = lookup_connect_ex2(iocpd->socket); // addrinfo is owned by the pconnection so pass NULL to the connect result connect_result_t *result = connect_result(iocpd, NULL); + iocpd->ops_in_progress++; + iocpd->active_completer = &pc->psocket; + // getpeername unreliable for outgoing connections, but we know it at this point + memcpy(&pc->remote.ss, ai->ai_addr, ai->ai_addrlen); DWORD unused; bool success = fn_connect_ex(iocpd->socket, ai->ai_addr, ai->ai_addrlen, NULL, 0, &unused, (LPOVERLAPPED) result); if (success || WSAGetLastError() == ERROR_IO_PENDING) { - iocpd->ops_in_progress++; - iocpd->active_completer = &pc->psocket; - // getpeername unreliable for outgoing connections, but we know it at this point - memcpy(&pc->remote.ss, ai->ai_addr, ai->ai_addrlen); return true; // logic resumes at connect_step_done() + } else { + iocpd->ops_in_progress--; + iocpd->active_completer = NULL; + memset(&pc->remote.ss, 0, sizeof(pc->remote.ss)); } pn_free(result); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org