qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cliffjan...@apache.org
Subject qpid-proton git commit: PROTON-798: fix hang for socket close during SSL negotiation
Date Tue, 13 Jan 2015 15:51:43 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master da1411e73 -> fc66f4c44


PROTON-798: fix hang for socket close during SSL negotiation


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/fc66f4c4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/fc66f4c4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/fc66f4c4

Branch: refs/heads/master
Commit: fc66f4c445996ba083fb8455594b2f14b1aaa275
Parents: da1411e
Author: Clifford Jansen <cliffjansen@apache.org>
Authored: Tue Jan 13 07:50:25 2015 -0800
Committer: Clifford Jansen <cliffjansen@apache.org>
Committed: Tue Jan 13 07:50:25 2015 -0800

----------------------------------------------------------------------
 proton-c/src/windows/iocp.c     | 10 +++++++---
 proton-c/src/windows/schannel.c | 18 ++++++++++++------
 2 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fc66f4c4/proton-c/src/windows/iocp.c
----------------------------------------------------------------------
diff --git a/proton-c/src/windows/iocp.c b/proton-c/src/windows/iocp.c
index 7b03b42..6acff41 100644
--- a/proton-c/src/windows/iocp.c
+++ b/proton-c/src/windows/iocp.c
@@ -1060,12 +1060,16 @@ static void zombie_list_hard_close_all(iocp_t *iocp)
 
 static void iocp_shutdown(iocpdesc_t *iocpd)
 {
+  bool disconnected = false;
   if (shutdown(iocpd->socket, SD_SEND)) {
-    if (iocpd->iocp->iocp_trace)
-      iocp_log("socket shutdown failed %d\n", WSAGetLastError());
+    int err = WSAGetLastError();
+    if (err == WSAECONNABORTED || err == WSAECONNRESET || err == WSAENOTCONN)
+      disconnected = true;
+    else if (iocpd->iocp->iocp_trace)
+      iocp_log("socket shutdown failed %d\n", err);
   }
   iocpd->write_closed = true;
-  if (iocpd->read_closed) {
+  if (iocpd->read_closed || disconnected) {
     closesocket(iocpd->socket);
     iocpd->socket = INVALID_SOCKET;
   }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fc66f4c4/proton-c/src/windows/schannel.c
----------------------------------------------------------------------
diff --git a/proton-c/src/windows/schannel.c b/proton-c/src/windows/schannel.c
index b775b52..353ce9b 100644
--- a/proton-c/src/windows/schannel.c
+++ b/proton-c/src/windows/schannel.c
@@ -1654,12 +1654,18 @@ static ssize_t process_output_ssl( pn_transport_t *transport, unsigned
int layer
       }
     }
 
-    if (ssl->network_out_pending == 0 && ssl->state == SHUTTING_DOWN) {
-      if (!ssl->queued_shutdown) {
-        start_ssl_shutdown(transport);
-        work_pending = true;
-      } else {
-        ssl->state = SSL_CLOSED;
+    if (ssl->network_out_pending == 0) {
+      if (ssl->state == SHUTTING_DOWN) {
+	if (!ssl->queued_shutdown) {
+	  start_ssl_shutdown(transport);
+	  work_pending = true;
+	} else {
+	  ssl->state = SSL_CLOSED;
+	}
+      }
+      else if (ssl->state == NEGOTIATING && ssl->app_input_closed) {
+	ssl->app_output_closed = PN_EOS;
+	ssl->state = SSL_CLOSED;
       }
     }
   } while (work_pending);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message