version 1.106.2.8, 2008/02/13 08:27:02
|
version 1.112, 2008/01/25 18:54:22
|
|
|
MessageLoaderParms parms("Common.HTTPAcceptor.FAILED_CREATE_SOCKET", | MessageLoaderParms parms("Common.HTTPAcceptor.FAILED_CREATE_SOCKET", |
"Failed to create socket"); | "Failed to create socket"); |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, | PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"HTTPAcceptor::_bind: createSocket() _rep->socket failed"); |
"HTTPAcceptor::_bind _rep->socket < 0"); |
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
| |
|
|
// | // |
if (::bind(_rep->socket, _rep->address, _rep->address_size) < 0) | if (::bind(_rep->socket, _rep->address, _rep->address_size) < 0) |
{ | { |
MessageLoaderParms parms( |
|
"Common.HTTPAcceptor.FAILED_BIND_SOCKET_DETAIL", |
|
"Failed to bind socket on port $0: $1.", |
|
_portNumber, PEGASUS_SYSTEM_NETWORK_ERRORMSG_NLS); |
|
|
|
Socket::close(_rep->socket); | Socket::close(_rep->socket); |
delete _rep; | delete _rep; |
_rep = 0; | _rep = 0; |
|
MessageLoaderParms parms("Common.HTTPAcceptor.FAILED_BIND_SOCKET", |
|
"Failed to bind socket"); |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, | PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"HTTPAcceptor::_bind: Failed to bind socket."); | "HTTPAcceptor::_bind: Failed to bind socket."); |
throw BindFailedException(parms); | throw BindFailedException(parms); |
|
|
S_IRGRP | S_IWGRP | S_IXGRP | | S_IRGRP | S_IWGRP | S_IXGRP | |
S_IROTH | S_IWOTH | S_IXOTH ) < 0 ) | S_IROTH | S_IWOTH | S_IXOTH ) < 0 ) |
{ | { |
MessageLoaderParms parms( |
|
"Common.HTTPAcceptor.FAILED_SET_LDS_FILE_OPTION", |
|
"Failed to set permission on local domain socket {0}: {1}.", |
|
PEGASUS_LOCAL_DOMAIN_SOCKET_PATH, |
|
PEGASUS_SYSTEM_ERRORMSG_NLS ); |
|
|
|
Socket::close(_rep->socket); | Socket::close(_rep->socket); |
delete _rep; | delete _rep; |
_rep = 0; | _rep = 0; |
|
MessageLoaderParms parms("Common.HTTPAcceptor.FAILED_BIND_SOCKET", |
|
"Failed to bind socket"); |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, | PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"HTTPAcceptor::_bind: Failed to set domain socket " | "HTTPAcceptor::_bind: Failed to set domain socket " |
"permissions."); | "permissions."); |
|
|
| |
//int const _maxConnectionQueueLength = 15; | //int const _maxConnectionQueueLength = 15; |
| |
if (::listen(_rep->socket, _maxConnectionQueueLength) < 0) |
if (listen(_rep->socket, _maxConnectionQueueLength) < 0) |
{ | { |
MessageLoaderParms parms( |
|
"Common.HTTPAcceptor.FAILED_LISTEN_SOCKET", |
|
"Failed to listen on socket {0}: {1}.", |
|
(int)_rep->socket,PEGASUS_SYSTEM_NETWORK_ERRORMSG_NLS ); |
|
|
|
Socket::close(_rep->socket); | Socket::close(_rep->socket); |
delete _rep; | delete _rep; |
_rep = 0; | _rep = 0; |
|
MessageLoaderParms parms("Common.HTTPAcceptor.FAILED_BIND_SOCKET", |
|
"Failed to bind socket"); |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, | PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"HTTPAcceptor::_bind: Failed to bind socket(1)."); | "HTTPAcceptor::_bind: Failed to bind socket(1)."); |
throw BindFailedException(parms); | throw BindFailedException(parms); |
|
|
_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; |
|
|
"HTTPAcceptor: accept() failed"); | "HTTPAcceptor: accept() failed"); |
return; | return; |
} | } |
#ifndef PEGASUS_OS_TYPE_WINDOWS |
#ifndef(PEGASUS_OS_TYPE_WINDOWS) |
// We need to ensure that the socket number is not higher than | // We need to ensure that the socket number is not higher than |
// what fits into FD_SETSIZE, because we else won't be able to select on it | // what fits into FD_SETSIZE, because we else won't be able to select on it |
// and won't ever communicate correct on that socket. | // and won't ever communicate correct on that socket. |
|
|
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. |