version 1.103, 2006/01/30 16:17:05
|
version 1.103.2.2, 2006/09/19 18:29:18
|
|
|
#endif | #endif |
throw Exception(parms); | throw Exception(parms); |
} | } |
|
|
|
Socket::disableBlocking(_tickle_peer_socket); |
|
Socket::disableBlocking(_tickle_client_socket); |
|
|
// add the tickler to the list of entries to be monitored and set to IDLE because Monitor only | // add the tickler to the list of entries to be monitored and set to IDLE because Monitor only |
// checks entries with IDLE state for events | // checks entries with IDLE state for events |
_MonitorEntry entry(_tickle_peer_socket, 1, INTERNAL); | _MonitorEntry entry(_tickle_peer_socket, 1, INTERNAL); |
|
|
}; | }; |
| |
AutoMutex autoMutex(_tickle_mutex); | AutoMutex autoMutex(_tickle_mutex); |
Socket::disableBlocking(_tickle_client_socket); |
|
Socket::write(_tickle_client_socket,&_buffer, 2); | Socket::write(_tickle_client_socket,&_buffer, 2); |
Socket::enableBlocking(_tickle_client_socket); |
|
} | } |
| |
void Monitor::setState( Uint32 index, _MonitorEntry::entry_status status ) | void Monitor::setState( Uint32 index, _MonitorEntry::entry_status status ) |
|
|
_entries[index]._status = status; | _entries[index]._status = status; |
} | } |
| |
Boolean Monitor::run(Uint32 milliseconds) |
void Monitor::run(Uint32 milliseconds) |
{ | { |
| |
Boolean handled_events = false; |
|
int i = 0; | int i = 0; |
| |
struct timeval tv = {milliseconds/1000, milliseconds%1000*1000}; | struct timeval tv = {milliseconds/1000, milliseconds%1000*1000}; |
|
|
Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, | Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"Monitor::run: Insufficient resources to process request."); | "Monitor::run: Insufficient resources to process request."); |
entries[indx]._status = _MonitorEntry::IDLE; | entries[indx]._status = _MonitorEntry::IDLE; |
return true; |
|
} | } |
*/ | */ |
// Added for PEP 183 | // Added for PEP 183 |
|
|
| |
entries[indx]._status = _MonitorEntry::BUSY; | entries[indx]._status = _MonitorEntry::BUSY; |
static char buffer[2]; | static char buffer[2]; |
Socket::disableBlocking(entries[indx].socket); |
|
Sint32 amt = Socket::read(entries[indx].socket,&buffer, 2); | Sint32 amt = Socket::read(entries[indx].socket,&buffer, 2); |
Socket::enableBlocking(entries[indx].socket); |
|
entries[indx]._status = _MonitorEntry::IDLE; | entries[indx]._status = _MonitorEntry::IDLE; |
} | } |
else | else |
|
|
// the array of entries can be changed. The ArrayIterator has be reset with the original _entries | // the array of entries can be changed. The ArrayIterator has be reset with the original _entries |
entries.reset(_entries); | entries.reset(_entries); |
entries[indx]._status = _MonitorEntry::IDLE; | entries[indx]._status = _MonitorEntry::IDLE; |
|
|
return true; |
|
} | } |
} | } |
catch(...) | catch(...) |
{ | { |
} | } |
handled_events = true; |
|
} | } |
} | } |
} | } |
|
|
return(handled_events); |
|
} | } |
| |
void Monitor::stopListeningForConnections(Boolean wait) | void Monitor::stopListeningForConnections(Boolean wait) |