version 1.116, 2008/02/26 19:15:05
|
version 1.121, 2008/05/13 01:00:42
|
|
|
_sslContextObjectLock(sslContextObjectLock), | _sslContextObjectLock(sslContextObjectLock), |
_idleConnectionTimeoutSeconds(0) | _idleConnectionTimeoutSeconds(0) |
{ | { |
|
PEGASUS_ASSERT(!_sslcontext == !_sslContextObjectLock); |
Socket::initializeInterface(); | Socket::initializeInterface(); |
| |
/* | /* |
|
|
SocketMessage* socketMessage = (SocketMessage*)message; | SocketMessage* socketMessage = (SocketMessage*)message; |
| |
// If this is a connection request: | // If this is a connection request: |
|
PEGASUS_ASSERT(socketMessage->socket == _rep->socket); |
|
|
|
PEGASUS_ASSERT(socketMessage->events & SocketMessage::READ); |
| |
if (socketMessage->socket == _rep->socket && |
|
socketMessage->events & SocketMessage::READ) |
|
{ |
|
_acceptConnection(); | _acceptConnection(); |
} |
|
else |
|
{ |
|
// ATTN! this can't happen! |
|
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::handleEnqueue: Invalid SOCKET_MESSAGE " |
|
"received."); |
|
} |
|
| |
break; | break; |
} | } |
|
|
} | } |
| |
default: | default: |
// ATTN: need unexpected message error! |
PEGASUS_ASSERT(false); |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::handleEnqueue: Invalid MESSAGE received."); |
|
break; | break; |
} | } |
| |
|
|
void HTTPAcceptor::handleEnqueue() | void HTTPAcceptor::handleEnqueue() |
{ | { |
Message* message = dequeue(); | Message* message = dequeue(); |
|
|
if (!message) |
|
{ |
|
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::handleEnqueue(): No message on queue."); |
|
return; |
|
} |
|
|
|
handleEnqueue(message); | handleEnqueue(message); |
} | } |
| |
|
|
{ | { |
MessageLoaderParms parms("Common.HTTPAcceptor.ALREADY_BOUND", | MessageLoaderParms parms("Common.HTTPAcceptor.ALREADY_BOUND", |
"HTTPAcceptor already bound"); | "HTTPAcceptor already bound"); |
|
|
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::bind: HTTPAcceptor already bound."); |
|
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
| |
|
|
_rep = 0; | _rep = 0; |
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, |
|
"HTTPAcceptor::_bind: createSocket() _rep->socket failed"); |
|
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
| |
|
|
_rep = 0; | _rep = 0; |
MessageLoaderParms parms("Common.HTTPAcceptor.FAILED_SET_SOCKET_OPTION", | MessageLoaderParms parms("Common.HTTPAcceptor.FAILED_SET_SOCKET_OPTION", |
"Failed to set socket option"); | "Failed to set socket option"); |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::_bind: Failed to set socket option."); |
|
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
| |
|
|
| |
delete _rep; | delete _rep; |
_rep = 0; | _rep = 0; |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::_bind: Failed to bind socket."); |
|
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
| |
|
|
// | // |
#if !defined(PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET) && \ | #if !defined(PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET) && \ |
(defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) || \ | (defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) || \ |
defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)) |
defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || \ |
|
defined(PEGASUS_OS_PASE)) |
if (_connectionType == LOCAL_CONNECTION) | if (_connectionType == LOCAL_CONNECTION) |
{ | { |
if (::chmod(PEGASUS_LOCAL_DOMAIN_SOCKET_PATH, | if (::chmod(PEGASUS_LOCAL_DOMAIN_SOCKET_PATH, |
|
|
| |
delete _rep; | delete _rep; |
_rep = 0; | _rep = 0; |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::_bind: Failed to set domain socket " |
|
"permissions."); |
|
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
} | } |
|
|
| |
delete _rep; | delete _rep; |
_rep = 0; | _rep = 0; |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::_bind: Failed to bind socket(1)."); |
|
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
| |
|
|
MessageLoaderParms parms( | MessageLoaderParms parms( |
"Common.HTTPAcceptor.FAILED_SOLICIT_SOCKET_MESSAGES", | "Common.HTTPAcceptor.FAILED_SOLICIT_SOCKET_MESSAGES", |
"Failed to solicit socket messaeges"); | "Failed to solicit socket messaeges"); |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
|
"HTTPAcceptor::_bind: Failed to solicit socket messages(2)."); |
|
throw BindFailedException(parms); | throw BindFailedException(parms); |
} | } |
} | } |
|
|
} | } |
else | else |
{ | { |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL2, |
"HTTPAcceptor::closeConnectionSocket failure _rep is null."); | "HTTPAcceptor::closeConnectionSocket failure _rep is null."); |
} | } |
} | } |
|
|
} | } |
else | else |
{ | { |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL2, |
"HTTPAcceptor::unbind failure _rep is null." ); | "HTTPAcceptor::unbind failure _rep is null." ); |
} | } |
} | } |
|
|
| |
return; | return; |
} | } |
|
PEG_TRACE(( |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
TRC_DISCARDED_DATA, |
"HTTPAcceptor - accept() failure. errno: $0", errno); |
Tracer::LEVEL1, |
|
"HTTPAcceptor: accept() failed. errno: %u", |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
errno)); |
"HTTPAcceptor: accept() failed"); |
|
return; | return; |
} | } |
| |
|
|
// the remote connection is invalid, destroy client address. | // the remote connection is invalid, destroy client address. |
delete accept_address; | delete accept_address; |
| |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
|
"HTTPAcceptor out of available sockets. " |
|
"Closing connection to the new client."); |
|
|
|
PEG_TRACE( | PEG_TRACE( |
(TRC_DISCARDED_DATA, | (TRC_DISCARDED_DATA, |
Tracer::LEVEL2, |
Tracer::LEVEL1, |
"accept() returned too large socket number %d.", |
"HTTPAcceptor out of available sockets." |
|
"accept() returned too large socket number %u." |
|
"Closing connection to the new client.", |
socket)); | socket)); |
| |
return; | return; |
|
|
0, | 0, |
NI_NUMERICHOST))) | NI_NUMERICHOST))) |
{ | { |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
PEG_TRACE(( |
"HTTPAcceptor - getnameinfo() failure. rc: $0", rc); |
TRC_DISCARDED_DATA, |
|
Tracer::LEVEL1, |
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"HTTPAcceptor: getnameinfo() failed. rc: %d", |
"HTTPAcceptor: getnameinfo() failed"); |
rc)); |
delete accept_address; | delete accept_address; |
return; | return; |
} | } |