version 1.49, 2003/09/26 19:04:06
|
version 1.50, 2003/09/28 03:27:45
|
|
|
} | } |
} | } |
| |
|
|
int events = select(FD_SETSIZE, &fdread, NULL, NULL, &tv); | int events = select(FD_SETSIZE, &fdread, NULL, NULL, &tv); |
| |
#ifdef PEGASUS_OS_TYPE_WINDOWS | #ifdef PEGASUS_OS_TYPE_WINDOWS |
if(events && events != SOCKET_ERROR ) |
if(events == SOCKET_ERROR) |
#else | #else |
if(events && events != -1 ) |
if(events == -1) |
#endif | #endif |
{ | { |
|
Tracer::trace(TRC_HTTP, Tracer::LEVEL4, |
|
"Monitor::run - errorno = %d has occurred on select.", errno); |
|
// The EBADF error indicates that one or more or the file |
|
// descriptions was not valid. This could indicate that |
|
// the _entries structure has been corrupted or that |
|
// we have a synchronization error. |
|
|
|
PEGASUS_ASSERT(errno != EBADF); |
|
} |
|
else if (events) |
|
{ |
for( int indx = 0; indx < (int)_entries.size(); indx++) | for( int indx = 0; indx < (int)_entries.size(); indx++) |
{ | { |
if(FD_ISSET(_entries[indx].socket, &fdread)) | if(FD_ISSET(_entries[indx].socket, &fdread)) |
|
|
| |
PEG_METHOD_ENTER(TRC_HTTP, "Monitor::solicitSocketMessages"); | PEG_METHOD_ENTER(TRC_HTTP, "Monitor::solicitSocketMessages"); |
| |
int index = -1; |
|
_entry_mut.lock(pegasus_thread_self()); | _entry_mut.lock(pegasus_thread_self()); |
| |
for(index = 0; index < (int)_entries.size(); index++) |
for(int index = 0; index < (int)_entries.size(); index++) |
{ | { |
try | try |
{ | { |
|
|
} | } |
_entry_mut.unlock(); | _entry_mut.unlock(); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return index; |
return -1; |
} | } |
| |
void Monitor::unsolicitSocketMessages(Sint32 socket) | void Monitor::unsolicitSocketMessages(Sint32 socket) |
{ | { |
|
|
PEG_METHOD_ENTER(TRC_HTTP, "Monitor::unsolicitSocketMessages"); | PEG_METHOD_ENTER(TRC_HTTP, "Monitor::unsolicitSocketMessages"); |
_entry_mut.lock(pegasus_thread_self()); | _entry_mut.lock(pegasus_thread_self()); |
| |
|
|
HTTPConnection *dst = reinterpret_cast<HTTPConnection *>(parm); | HTTPConnection *dst = reinterpret_cast<HTTPConnection *>(parm); |
| |
dst->run(1); | dst->run(1); |
if( dst->_monitor->_entries.size() > (Uint32)dst->_entry_index ) |
dst->_monitor->_entry_mut.lock(pegasus_thread_self()); |
dst->_monitor->_entries[dst->_entry_index]._status = _MonitorEntry::IDLE; |
|
| |
|
// It shouldn't be necessary to set status = _MonitorEntry::IDLE |
|
// if the connection is being closed. However, the current logic |
|
// in Monitor::run requires this value to be set for the close |
|
// to be processed. |
|
dst->_monitor->_entries[dst->_entry_index]._status = _MonitorEntry::IDLE; |
|
if (dst->_connectionClosePending) |
|
{ |
|
dst->_dying = 1; |
|
} |
|
dst->_monitor->_entry_mut.unlock(); |
return 0; | return 0; |
} | } |
| |