version 1.106.2.1, 2007/12/14 20:31:37
|
version 1.109, 2007/12/18 18:50:45
|
|
|
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
| |
|
Socket::disableBlocking(_rep->socket); |
| |
// set the close-on-exec bit for this file handle. | // set the close-on-exec bit for this file handle. |
// any unix that forks needs this bit set. | // any unix that forks needs this bit set. |
|
|
_rep->socket, | _rep->socket, |
SocketMessage::READ | SocketMessage::EXCEPTION, | SocketMessage::READ | SocketMessage::EXCEPTION, |
getQueueId(), | getQueueId(), |
Monitor::ACCEPTOR))) |
MonitorEntry::TYPE_ACCEPTOR))) |
{ | { |
Socket::close(_rep->socket); | Socket::close(_rep->socket); |
delete _rep; | delete _rep; |
|
|
#endif | #endif |
} | } |
| |
SocketHandle socket; |
// It is not necessary to handle EINTR errors from this accept() call. |
#ifdef PEGASUS_OS_TYPE_WINDOWS |
// An EINTR error should not occur on a non-blocking socket. If the |
socket = accept(_rep->socket, accept_address, &address_size); |
// listen socket is blocking and EINTR occurs, the new socket connection |
#else |
// is not accepted here. |
while ( |
|
((socket = accept(_rep->socket, accept_address, &address_size)) == -1) |
// EAGAIN errors are also not handled here. An EAGAIN error should not |
&& (errno == EINTR)) |
// occur after select() indicates that the listen socket is available for |
; |
// reading. If the accept() fails with an EAGAIN error code, a new |
#endif |
// connection is not accepted here. |
|
|
|
SocketHandle socket = accept(_rep->socket, accept_address, &address_size); |
| |
if (socket == PEGASUS_SOCKET_ERROR) | if (socket == PEGASUS_SOCKET_ERROR) |
{ | { |
|
|
SharedPtr<MP_Socket> mp_socket(new MP_Socket( | SharedPtr<MP_Socket> mp_socket(new MP_Socket( |
socket, _sslcontext, _sslContextObjectLock, ipAddress)); | socket, _sslcontext, _sslContextObjectLock, ipAddress)); |
| |
|
mp_socket->disableBlocking(); |
mp_socket->setSocketWriteTimeout(_socketWriteTimeout); | mp_socket->setSocketWriteTimeout(_socketWriteTimeout); |
| |
// Perform the SSL handshake, if applicable. Make the socket non-blocking |
// Perform the SSL handshake, if applicable. |
// for this operation so we can send it back to the Monitor's select() loop |
|
// if it takes a while. |
|
| |
mp_socket->disableBlocking(); |
|
Sint32 socketAcceptStatus = mp_socket->accept(); | Sint32 socketAcceptStatus = mp_socket->accept(); |
mp_socket->enableBlocking(); |
|
| |
if (socketAcceptStatus < 0) | if (socketAcceptStatus < 0) |
{ | { |
|
|
if (-1 == (index = _monitor->solicitSocketMessages( | if (-1 == (index = _monitor->solicitSocketMessages( |
connection->getSocket(), | connection->getSocket(), |
SocketMessage::READ | SocketMessage::EXCEPTION, | SocketMessage::READ | SocketMessage::EXCEPTION, |
connection->getQueueId(), Monitor::CONNECTION)) ) |
connection->getQueueId(), MonitorEntry::TYPE_CONNECTION)) ) |
{ | { |
// ATTN-DE-P2-2003100503::TODO::Need to enhance code to return | // ATTN-DE-P2-2003100503::TODO::Need to enhance code to return |
// an error message to Client application. | // an error message to Client application. |