version 1.100, 2005/12/02 18:25:52
|
version 1.105, 2006/06/09 20:36:06
|
|
|
//%2005//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; | // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// EMC Corporation; VERITAS Software Corporation; The Open Group. | // EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
# include <netinet/in.h> | # include <netinet/in.h> |
# include <netdb.h> | # include <netdb.h> |
# include <arpa/inet.h> | # include <arpa/inet.h> |
|
# include <netinet/tcp.h> |
#endif | #endif |
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
throw Exception(parms); | throw Exception(parms); |
} | } |
| |
|
// set TCP_NODELAY |
|
int opt = 1; |
|
setsockopt(_tickle_server_socket, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, sizeof(opt)); |
|
|
// initialize the address | // initialize the address |
memset(&_tickle_server_addr, 0, sizeof(_tickle_server_addr)); | memset(&_tickle_server_addr, 0, sizeof(_tickle_server_addr)); |
#ifdef PEGASUS_PLATFORM_OS400_ISERIES_IBM | #ifdef PEGASUS_PLATFORM_OS400_ISERIES_IBM |
|
|
throw Exception(parms); | throw Exception(parms); |
} | } |
| |
|
// set TCP_NODELAY |
|
setsockopt(_tickle_client_socket, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, sizeof(opt)); |
|
|
// setup the address of the client | // setup the address of the client |
memset(&_tickle_client_addr, 0, sizeof(_tickle_client_addr)); | memset(&_tickle_client_addr, 0, sizeof(_tickle_client_addr)); |
#ifdef PEGASUS_PLATFORM_OS400_ISERIES_IBM | #ifdef PEGASUS_PLATFORM_OS400_ISERIES_IBM |
|
|
autoEntryMutex.unlock(); | autoEntryMutex.unlock(); |
o.enqueue(message); | o.enqueue(message); |
autoEntryMutex.lock(); | autoEntryMutex.lock(); |
|
// After enqueue a message and the autoEntryMutex has been released and locked again, |
|
// the array of _entries can be changed. The ArrayIterator has be reset with the original _entries. |
|
entries.reset(_entries); |
} | } |
} | } |
| |
|
|
int events = select(maxSocketCurrentPass, &fdread, NULL, NULL, &tv); | int events = select(maxSocketCurrentPass, &fdread, NULL, NULL, &tv); |
#endif | #endif |
autoEntryMutex.lock(); | autoEntryMutex.lock(); |
|
// After enqueue a message and the autoEntryMutex has been released and locked again, |
|
// the array of _entries can be changed. The ArrayIterator has be reset with the original _entries |
|
entries.reset(_entries); |
#ifdef PEGASUS_OS_TYPE_WINDOWS | #ifdef PEGASUS_OS_TYPE_WINDOWS |
if(events == SOCKET_ERROR) | if(events == SOCKET_ERROR) |
#else | #else |
|
|
autoEntryMutex.unlock(); | autoEntryMutex.unlock(); |
q->enqueue(msg); | q->enqueue(msg); |
autoEntryMutex.lock(); | autoEntryMutex.lock(); |
|
// After enqueue a message and the autoEntryMutex has been released and locked again, |
|
// the array of entries can be changed. The ArrayIterator has be reset with the original _entries |
|
entries.reset(_entries); |
entries[indx]._status = _MonitorEntry::IDLE; | entries[indx]._status = _MonitorEntry::IDLE; |
| |
return true; | return true; |
|
|
// Wait for the monitor to notice _stopConnections. Otherwise the | // Wait for the monitor to notice _stopConnections. Otherwise the |
// caller of this function may unbind the ports while the monitor | // caller of this function may unbind the ports while the monitor |
// is still accepting connections on them. | // is still accepting connections on them. |
try |
_stopConnectionsSem.wait(); |
{ |
|
_stopConnectionsSem.time_wait(10000); |
|
} |
|
catch (TimeOut &) |
|
{ |
|
// The monitor is probably busy processng a very long request, and is |
|
// not accepting connections. Let the caller unbind the ports. |
|
} |
|
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |