Public Types | |
typedef unsigned short | SocketCount |
Static Public Attributes | |
static const SocketCount | NoPooledSockets = 0xFFFF |
Pass this value as maxFreeSockets to constructors to create an allocator that doesn't pool sockets at all. | |
Protected Member Functions | |
CSocketAllocator (SocketCount maxFreeSockets, PerSocketBufferPoolingLimit maxPooledBuffers, ConsecutiveSocketOperations maxConsecutiveOperations) | |
CSocketAllocator (IMonitorSocketAllocation &monitor, SocketCount maxFreeSockets, PerSocketBufferPoolingLimit maxPooledBuffers, ConsecutiveSocketOperations maxConsecutiveOperations) | |
CSocketAllocator (const CSocketAllocator &rhs) | |
virtual | ~CSocketAllocator () |
CSocketAllocator & | operator= (const CSocketAllocator &rhs) |
SocketCount | EnlargePool (SocketCount socketsToAdd) |
Create socketsToAdd sockets and add them to the pool. Returns the number of sockets now in the pool. | |
IPoolableSocket & | AllocatePoolableSocket (IPoolableSocketManager &manager, ISocketCallback &callback, SOCKET theSocket) |
Allocate an instance of IPoolableSocket which has the supplied manager as its manager, the supplied callback interface for callbacks and which is attached to the supplied SOCKET. | |
virtual void | ReleaseSocket (IPoolableSocket &socket) |
Release the supplied socket and, either return it to the pool for later reuse or destroy it. | |
virtual DWORD | AbortMyConnections (const IPoolableSocketManager &manager, ConnectionClosureReason reason) |
Walk the list of active connections and abort any that are managed by the supplied manager. Returns the number of active connections that were aborted. Note that the allocator can support more than max(SocketCount) active connections; the size of SocketCount only limits the number of pooled connections. | |
virtual void | DumpMyConnections (const IPoolableSocketManager &manager) const |
virtual bool | ReleaseSockets () |
Forcibly release, and destroy, all active and inactive sockets. Use with care and only in a debugging/system shutdown scenario. | |
virtual JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex | RequestUserDataSlot (const JetByteTools::Core::_tstring &name) |
Implement IProvideUserData. | |
virtual JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex | LockUserDataSlots () |
typedef unsigned short SocketCount |
Reimplemented in TSocketAllocator, TSocketAllocator< JetByteTools::Socket::IAllocateDatagramSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateStreamSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateSequencedStreamSockets >, and TSocketAllocator< JetByteTools::Socket::IAllocateDatagramServerSockets >.
CSocketAllocator | ( | SocketCount | maxFreeSockets, | |
PerSocketBufferPoolingLimit | maxPooledBuffers, | |||
ConsecutiveSocketOperations | maxConsecutiveOperations | |||
) | [protected] |
CSocketAllocator | ( | IMonitorSocketAllocation & | monitor, | |
SocketCount | maxFreeSockets, | |||
PerSocketBufferPoolingLimit | maxPooledBuffers, | |||
ConsecutiveSocketOperations | maxConsecutiveOperations | |||
) | [protected] |
CSocketAllocator | ( | const CSocketAllocator & | rhs | ) | [protected] |
~CSocketAllocator | ( | ) | [protected, virtual] |
CSocketAllocator& operator= | ( | const CSocketAllocator & | rhs | ) | [protected] |
CSocketAllocator::SocketCount EnlargePool | ( | SocketCount | socketsToAdd | ) | [protected] |
Create socketsToAdd sockets and add them to the pool. Returns the number of sockets now in the pool.
IPoolableSocket & AllocatePoolableSocket | ( | IPoolableSocketManager & | manager, | |
ISocketCallback & | callback, | |||
SOCKET | theSocket | |||
) | [protected] |
Allocate an instance of IPoolableSocket which has the supplied manager as its manager, the supplied callback interface for callbacks and which is attached to the supplied SOCKET.
void ReleaseSocket | ( | IPoolableSocket & | socket | ) | [protected, virtual] |
Release the supplied socket and, either return it to the pool for later reuse or destroy it.
Reimplemented in TSocketAllocator, TSocketAllocator< JetByteTools::Socket::IAllocateDatagramSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateStreamSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateSequencedStreamSockets >, and TSocketAllocator< JetByteTools::Socket::IAllocateDatagramServerSockets >.
DWORD AbortMyConnections | ( | const IPoolableSocketManager & | manager, | |
ConnectionClosureReason | reason | |||
) | [protected, virtual] |
Walk the list of active connections and abort any that are managed by the supplied manager. Returns the number of active connections that were aborted. Note that the allocator can support more than max(SocketCount) active connections; the size of SocketCount only limits the number of pooled connections.
Reimplemented in TSocketAllocator, TSocketAllocator< JetByteTools::Socket::IAllocateDatagramSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateStreamSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateSequencedStreamSockets >, and TSocketAllocator< JetByteTools::Socket::IAllocateDatagramServerSockets >.
void DumpMyConnections | ( | const IPoolableSocketManager & | manager | ) | const [protected, virtual] |
Reimplemented in TSocketAllocator, TSocketAllocator< JetByteTools::Socket::IAllocateDatagramSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateStreamSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateSequencedStreamSockets >, and TSocketAllocator< JetByteTools::Socket::IAllocateDatagramServerSockets >.
bool ReleaseSockets | ( | ) | [protected, virtual] |
Forcibly release, and destroy, all active and inactive sockets. Use with care and only in a debugging/system shutdown scenario.
Reimplemented in TSocketAllocator, TSocketAllocator< JetByteTools::Socket::IAllocateDatagramSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateStreamSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateSequencedStreamSockets >, and TSocketAllocator< JetByteTools::Socket::IAllocateDatagramServerSockets >.
virtual JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex RequestUserDataSlot | ( | const JetByteTools::Core::_tstring & | name | ) | [protected, virtual] |
Implement IProvideUserData.
Reimplemented in TSocketAllocator, TSocketAllocator< JetByteTools::Socket::IAllocateDatagramSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateStreamSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateSequencedStreamSockets >, and TSocketAllocator< JetByteTools::Socket::IAllocateDatagramServerSockets >.
IIndexedOpaqueUserData::UserDataIndex LockUserDataSlots | ( | ) | [protected, virtual] |
Reimplemented in TSocketAllocator, TSocketAllocator< JetByteTools::Socket::IAllocateDatagramSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateStreamSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateSequencedStreamSockets >, and TSocketAllocator< JetByteTools::Socket::IAllocateDatagramServerSockets >.
const CSocketAllocator::SocketCount NoPooledSockets = 0xFFFF [static] |
Pass this value as maxFreeSockets to constructors to create an allocator that doesn't pool sockets at all.