version 1.26.4.1, 2008/01/02 21:05:03
|
version 1.29, 2008/02/26 19:15:05
|
|
|
} | } |
} | } |
| |
void Socket::close(SocketHandle socket) |
void Socket::close(SocketHandle& socket) |
{ | { |
if (socket != -1) |
if (socket != PEGASUS_INVALID_SOCKET) |
{ | { |
#ifdef PEGASUS_OS_TYPE_WINDOWS | #ifdef PEGASUS_OS_TYPE_WINDOWS |
if (!closesocket(socket)) | if (!closesocket(socket)) |
socket = -1; |
{ |
|
socket = PEGASUS_INVALID_SOCKET; |
|
} |
#else | #else |
int status; | int status; |
PEGASUS_RETRY_SYSTEM_CALL(::close(socket), status); | PEGASUS_RETRY_SYSTEM_CALL(::close(socket), status); |
| |
if (status == 0) | if (status == 0) |
socket = -1; |
{ |
|
socket = PEGASUS_INVALID_SOCKET; |
|
} |
#endif | #endif |
} | } |
} | } |
|
|
{ | { |
newSocket = socket(domain,type,protocol); | newSocket = socket(domain,type,protocol); |
| |
|
if ((newSocket != PEGASUS_INVALID_SOCKET) || |
|
(getSocketError() != PEGASUS_NETWORK_TRYAGAIN)) |
|
{ |
|
break; |
|
} |
|
|
|
#ifdef PEGASUS_OS_ZOS |
// The program should wait for transport layer to become ready. | // The program should wait for transport layer to become ready. |
| |
if (newSocket == PEGASUS_INVALID_SOCKET && |
|
getSocketError() == PEGASUS_NETWORK_TCPIP_TRYAGAIN ) |
|
{ |
|
if (sendTcpipMsg) | if (sendTcpipMsg) |
{ | { |
Logger::put_l( | Logger::put_l( |
|
|
} | } |
| |
System::sleep(30); | System::sleep(30); |
continue; |
#endif |
} |
|
else |
|
{ |
|
break; |
|
} |
|
} // wait for the transport layer become ready. | } // wait for the transport layer become ready. |
| |
// Is the socket in an unrecoverable error ? | // Is the socket in an unrecoverable error ? |