summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--THANKS1
-rw-r--r--ace/SPIPE_Acceptor.cpp33
3 files changed, 42 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3738da44f23..553b5bbe3cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Feb 7 23:28:29 UTC 2006 Steve Huston <shuston@riverace.com>
+
+ * ace/SPIPE_Acceptor.cpp (close): On Windows, wait for completion
+ (cancellation) of an outstanding ConnectNamedPipe operation. If
+ left outstanding and the ACE_SPIPE_Acceptor object is deleted, the
+ OS will write into deleted memory. Thanks to Nathan Bamford
+ <nbamford at datalever dot com> for reporting this.
+
+ * THANKS: Added Nathan Bamford to the Hall of Fame.
+
Wed Feb 08 15:46:51 2006 Wallace Zhang <zhangw@ociweb.com>
* ACE version 5.4.9 released.
diff --git a/THANKS b/THANKS
index 20ddc5c16bc..7afdb139115 100644
--- a/THANKS
+++ b/THANKS
@@ -2062,6 +2062,7 @@ Thomas E Lackey <telackey at bozemanpass dot com>
luxi78 at gmail dot com
John Lilley <jlilley at datalever dot com>
Abdullah Sowayan <abdullah dot sowayan at lmco dot com>
+Nathan Bamford <nbamford at datalever dot com>
Zoltan Molnar <zolmol at isis dot vanderbilt dot edu>
I would particularly like to thank Paul Stephenson, who worked with me
diff --git a/ace/SPIPE_Acceptor.cpp b/ace/SPIPE_Acceptor.cpp
index 9473e0d629c..a9303f0897d 100644
--- a/ace/SPIPE_Acceptor.cpp
+++ b/ace/SPIPE_Acceptor.cpp
@@ -183,9 +183,16 @@ ACE_SPIPE_Acceptor::close (void)
ACE_TRACE ("ACE_SPIPE_Acceptor::close");
#if (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))
- // Substitute the pipe handle back in so it's closed properly.
+
+ // Check to see if we have a valid pipe; if not, nothing to do.
+ if (this->pipe_handle_ == ACE_INVALID_HANDLE)
+ return -1;
+
+ // Substitute the pipe handle back in so it's closed properly in the
+ // ACE_OS wrapper. But leave the pipe_handle_ value so we can clean up the
+ // hanging overlapped operation afterwards.
this->set_handle (this->pipe_handle_);
- this->pipe_handle_ = ACE_INVALID_HANDLE;
+
#endif /* ACE_WIN32 */
// This behavior is shared by UNIX and Win32...
@@ -194,7 +201,29 @@ ACE_SPIPE_Acceptor::close (void)
#if defined (ACE_HAS_STREAM_PIPES)
ACE_OS::fdetach (this->local_addr_.get_path_name ());
+#elif (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))
+
+ // open () started the Connect in asynchronous mode, and accept() restarts
+ // the ConnectNamedPipe in overlapped mode. To avoid leaving a hanging
+ // overlapped operation that'll write into members of this object,
+ // wait for the event in the OVERLAPPED structure to be signalled.
+ if (this->already_connected_ == 0)
+ {
+ if (this->event_.wait () != -1)
+ {
+ // Should be here with the ConnectNamedPipe operation complete.
+ // Steal the already_connected_ flag to record the results.
+ DWORD unused;
+ ::GetOverlappedResult (this->pipe_handle_,
+ &this->overlapped_,
+ &unused,
+ FALSE);
+ }
+ this->pipe_handle_ = ACE_INVALID_HANDLE;
+ this->already_connected_ = 0;
+ }
#endif /* ACE_HAS_STREAM_PIPES */
+
return result;
}