The C++ framework for developing highly scalable, high performance servers on Windows platforms.

CReadTimeoutStreamSocketConnectionFilter Class Reference
[Filtering]

Inheritance diagram for CReadTimeoutStreamSocketConnectionFilter:
Collaboration diagram for CReadTimeoutStreamSocketConnectionFilter:

List of all members.


Detailed Description

A connection filter that filters supplied read timeout functionality. A call to SetReadTimeout() on a socket will set a timeout for every read operation that is issued on the socket. If the timeout expires then the TimerCallback::OnTimer() method of the callback that was passed to the call to SetReadTimeout() is called with the socket and user data. If you require different user data and/or timer callbacks for a particular timeout then you can call SetSingleReadTimeout() to specify this information. Normal usage is to call SetReadTimeout() when the connection is established and then, possibly, call SetSingleReadTimeout() when the 'default' timeout occurs on a socket to change the timeout parameters from this point on... Call CancelReadTimeout() to stop setting timeouts on all future reads (and to cancel any currently pending timeout) and CancelPendingTimeout() to just cancel any currently pending timeouts but to continue to set timeouts on all subsequent read operations.


Public Types

typedef
JetByteTools::Core::IQueueTimers::UserData 
UserData
 User data that can be passed to the TimerCallback::OnTimer() call.

Public Member Functions

 CReadTimeoutStreamSocketConnectionFilter (IAcceptStreamSocketConnectionFilters &manager, JetByteTools::Core::IQueueTimers &timerQueue)
 Installs the connection filter on all connections made by the supplied manager and allocates space for timer data in all sockets allocated by the supplied socket allocator and queues timers using the supplied timer queue.
 CReadTimeoutStreamSocketConnectionFilter (const CReadTimeoutStreamSocketConnectionFilter &rhs)
CReadTimeoutStreamSocketConnectionFilteroperator= (const CReadTimeoutStreamSocketConnectionFilter &rhs)
void SetupReadTimeout (IStreamSocket &socket, Milliseconds timeout, TimerCallback &timerCallback, UserData userData=0) const
 Sets up a read timeout for the socket. The timeout will be set after every read is issued on the socket. Note that the timeout is NOT set until the next read is issued.
void SetReadTimeout (IStreamSocket &socket, Milliseconds timeout, TimerCallback &timerCallback, UserData userData=0)
 Sets a read timeout on the socket. The timeout will be set after every read is issued on the socket. Note that the timeout is set straight away but will be reset when the next read is issued.
void SetSingleReadTimeout (IStreamSocket &socket, Milliseconds timeout, TimerCallback &timerCallback, UserData userData=0)
 Sets a single read timeout on the socket. This can be used to set a different timeout to the 'default' timeout that is set with all read operations. Note that there's only one timeout per socket and setting this timeout cancels any pending 'default' read timeout that may have been set when the last read was issued. Usually called from the TimerCallback::OnTimer() handler to set an additional timeout after the 'default' timeout has expired.
void SetDisconnectTimeout (IStreamSocket &socket, Milliseconds timeout, TimerCallback &timerCallback, UserData userData=0)
 Sets a disconnect timeout on the socket. The timeout is set once and no further timeouts can be set. Note that the timeout is set straight away and does NOT get reset by read completions. The timer WILL fire when it expires unless the connection has already been disconnected.
void CancelReadTimeout (IStreamSocket &socket) const
 Cancels any pending timeouts and prevents any more timeouts being set for any subsequent read operations on the supplied socket.
void CancelPendingTimeout (IStreamSocket &socket) const
 Cancels any pending timeouts on the supplied socket.

Classes

class  TimerCallback


Member Typedef Documentation

User data that can be passed to the TimerCallback::OnTimer() call.

Reimplemented from IQueueTimers::Timer.


Constructor & Destructor Documentation

Installs the connection filter on all connections made by the supplied manager and allocates space for timer data in all sockets allocated by the supplied socket allocator and queues timers using the supplied timer queue.


Member Function Documentation

void SetupReadTimeout ( IStreamSocket socket,
Milliseconds  timeout,
TimerCallback timerCallback,
UserData  userData = 0 
) const

Sets up a read timeout for the socket. The timeout will be set after every read is issued on the socket. Note that the timeout is NOT set until the next read is issued.

void SetReadTimeout ( IStreamSocket socket,
Milliseconds  timeout,
TimerCallback timerCallback,
UserData  userData = 0 
)

Sets a read timeout on the socket. The timeout will be set after every read is issued on the socket. Note that the timeout is set straight away but will be reset when the next read is issued.

void SetSingleReadTimeout ( IStreamSocket socket,
Milliseconds  timeout,
TimerCallback timerCallback,
UserData  userData = 0 
)

Sets a single read timeout on the socket. This can be used to set a different timeout to the 'default' timeout that is set with all read operations. Note that there's only one timeout per socket and setting this timeout cancels any pending 'default' read timeout that may have been set when the last read was issued. Usually called from the TimerCallback::OnTimer() handler to set an additional timeout after the 'default' timeout has expired.

void SetDisconnectTimeout ( IStreamSocket socket,
Milliseconds  timeout,
TimerCallback timerCallback,
UserData  userData = 0 
)

Sets a disconnect timeout on the socket. The timeout is set once and no further timeouts can be set. Note that the timeout is set straight away and does NOT get reset by read completions. The timer WILL fire when it expires unless the connection has already been disconnected.

void CancelReadTimeout ( IStreamSocket socket  )  const

Cancels any pending timeouts and prevents any more timeouts being set for any subsequent read operations on the supplied socket.

void CancelPendingTimeout ( IStreamSocket socket  )  const

Cancels any pending timeouts on the supplied socket.


Generated on Sun Sep 12 19:10:36 2021 for The Server Framework - v7.4 by doxygen 1.5.3