From 136d48c6eec33708153162f00bb35a65a31e5800 Mon Sep 17 00:00:00 2001 From: "Stephen D. Huston" Date: Tue, 17 Mar 2009 23:19:12 +0000 Subject: Correct the handling of end-of-connection cases; fixes QPID-1550 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@755441 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/windows/AsynchIO.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'cpp') diff --git a/cpp/src/qpid/sys/windows/AsynchIO.cpp b/cpp/src/qpid/sys/windows/AsynchIO.cpp index 37d87947a2..0a3c36452c 100644 --- a/cpp/src/qpid/sys/windows/AsynchIO.cpp +++ b/cpp/src/qpid/sys/windows/AsynchIO.cpp @@ -690,10 +690,9 @@ void AsynchIO::writeComplete(AsynchWriteResult *result) { } } - // If there are no writes outstanding, the priority is to write any - // remaining buffers first (either queued or via idle), then close the - // socket if that's queued. - // opsInProgress handled in completion() + // If there are no writes outstanding, check for more writes to initiate + // (either queued or via idle). The opsInProgress count is handled in + // completion() if (!writeInProgress) { bool writing = false; { @@ -706,11 +705,8 @@ void AsynchIO::writeComplete(AsynchWriteResult *result) { writing = true; } } - if (!writing) { - if (queuedClose) - close(); - else - notifyIdle(); + if (!writing && !queuedClose) { + notifyIdle(); } } return; @@ -757,9 +753,11 @@ void AsynchIO::completion(AsynchIoResult *result) { } working = false; } - // Lock released; ok to delete if all is done. - if (opsInProgress == 0 && queuedDelete) - delete this; + // Lock released; ok to close if ops are done and close requested. + // Layer above will call back to queueForDeletion() + if (opsInProgress == 0 && queuedClose) { + close(); + } } } // namespace windows -- cgit v1.2.1