diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2003-02-10 15:23:10 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2003-02-10 15:23:10 +0000 |
commit | 2542fc886ed77df2169a432fd68559061cff07eb (patch) | |
tree | 0b4bddeca6b9e6df8e23b71299127ba0e7d76bfa | |
parent | 82a6a56d63e3d4d0df725304430757f178d1d1c1 (diff) | |
download | ATCD-2542fc886ed77df2169a432fd68559061cff07eb.tar.gz |
ChangeLog tag: Mon Feb 10 09:22:04 2003 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 7 | ||||
-rw-r--r-- | ace/SPIPE_Stream.i | 66 |
3 files changed, 80 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 2da555d2311..921afeb5495 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Feb 10 09:22:04 2003 Phil Mesnier <mesnier_p@ociweb.com> + + * ace/SPIPE_Stream.i: Added a special case for win32 platforms to + ACE_SPIPE_Stream::send_handle() and recv_handle() to allow handle + passing. The extension is necessary since the receiving side must + open the duplicate handle before the sending side closes it. + Fri Feb 7 17:22:39 2003 Steve Huston <shuston@riverace.com> * ace/OS.cpp (ACE_OS::thr_create): Moved the pthread_setstack() call diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 2da555d2311..921afeb5495 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,10 @@ +Mon Feb 10 09:22:04 2003 Phil Mesnier <mesnier_p@ociweb.com> + + * ace/SPIPE_Stream.i: Added a special case for win32 platforms to + ACE_SPIPE_Stream::send_handle() and recv_handle() to allow handle + passing. The extension is necessary since the receiving side must + open the duplicate handle before the sending side closes it. + Fri Feb 7 17:22:39 2003 Steve Huston <shuston@riverace.com> * ace/OS.cpp (ACE_OS::thr_create): Moved the pthread_setstack() call diff --git a/ace/SPIPE_Stream.i b/ace/SPIPE_Stream.i index 4c458e7c3ad..081a8ab4596 100644 --- a/ace/SPIPE_Stream.i +++ b/ace/SPIPE_Stream.i @@ -97,6 +97,38 @@ ACE_SPIPE_Stream::send_handle (ACE_HANDLE handle) const ACE_TRACE ("ACE_SPIPE_Stream::send_handle"); #if defined (ACE_HAS_STREAM_PIPES) return ACE_OS::ioctl (this->get_handle (), I_SENDFD, (void *) handle); +#elif defined (ACE_WIN32) + DWORD procID; + WSAPROTOCOL_INFO protInfo; + ssize_t res; + res = this->recv(&procID, sizeof(procID)); + if (res != sizeof(procID)) + { + if(res != -1) + errno = ENXIO; + return -1; + } + if (::WSADuplicateSocket ((SOCKET)handle, procID, &protInfo) == -1) + { + ACE_OS::set_errno_to_wsa_last_error(); + return -1; + } + res = this->send(&protInfo, sizeof(protInfo)); + if (res != sizeof(protInfo)) + { + if(res != -1) + errno = ENXIO; + return -1; + } + // This is just for synchronization, we will ignore the data + res = this->recv(&procID, sizeof(procID)); + if (res != sizeof(procID)) + { + if(res != -1) + errno = ENXIO; + return -1; + } + return 0; #else handle = handle; ACE_NOTSUP_RETURN (-1); @@ -119,6 +151,40 @@ ACE_SPIPE_Stream::recv_handle (ACE_HANDLE &handle) const handle = recvfd.fd; return 0; } +#elif defined (ACE_WIN32) + pid_t procID = ACE_OS::getpid(); + WSAPROTOCOL_INFO protInfo; + ssize_t res; + res = this->send(&procID, sizeof(procID)); + if (res != sizeof(procID)) + { + if(res != -1) + errno = ENXIO; + return -1; + } + res = this->recv(&protInfo, sizeof(protInfo)); + if (res != sizeof(protInfo)) + { + if(res != -1) + errno = ENXIO; + return -1; + } + handle = ACE_OS::socket (FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, + &protInfo, 0, 0); + if (handle == ACE_INVALID_HANDLE) + { + return -1; + } + // Since it does not matter what the data is, just send something to + // synchronize the end of the exchange + res = this->send(&procID, sizeof(procID)); + if (res != sizeof(procID)) + { + if(res != -1) + errno = ENXIO; + return -1; + } + return 0; #else handle = handle; ACE_NOTSUP_RETURN (-1); |