LLIOServerSocket Class Reference

An IOPipe implementation which listens and spawns connected sockets. More...

#include <lliosocket.h>

Inheritance diagram for LLIOServerSocket:

Inheritance graph
[legend]
Collaboration diagram for LLIOServerSocket:

Collaboration graph
[legend]
List of all members.

Public Types

typedef LLSocket::ptr_t socket_t
typedef boost::shared_ptr<
LLChainIOFactory
factory_t

Public Member Functions

 LLIOServerSocket (apr_pool_t *pool, socket_t listener, factory_t reactor)
virtual ~LLIOServerSocket ()
void setResponseTimeout (F32 timeout_secs)
 Set the timeout for the generated chains.

Protected Member Functions

virtual EStatus process_impl (const LLChannelDescriptors &channels, buffer_ptr_t &buffer, bool &eos, LLSD &context, LLPumpIO *pump)
 Process the data in buffer.

Protected Attributes

apr_pool_tmPool
socket_t mListenSocket
factory_t mReactor
bool mInitialized
F32 mResponseTimeout

Detailed Description

An IOPipe implementation which listens and spawns connected sockets.

See also:
LLIOPipe, LLChainIOFactory
Each server socket instance coordinates with a pump to ensure it only processes waiting connections. It uses the provided socket, and assumes it is correctly initialized. When the connection is established, the server will call the chain factory to build a chain, and attach a socket reader and the front and a socket writer at the end. It is up to the chain factory to create something which correctly handles the established connection using the reader as a source, and the writer as the final sink. The newly added chain timeout is in DEFAULT_CHAIN_EXPIRY_SECS unless adjusted with a call to setResponseTimeout().

Definition at line 296 of file lliosocket.h.


Member Typedef Documentation

typedef boost::shared_ptr<LLChainIOFactory> LLIOServerSocket::factory_t

Definition at line 300 of file lliosocket.h.

typedef LLSocket::ptr_t LLIOServerSocket::socket_t

Definition at line 299 of file lliosocket.h.


Constructor & Destructor Documentation

LLIOServerSocket::LLIOServerSocket ( apr_pool_t pool,
LLIOServerSocket::socket_t  listener,
factory_t  factory 
)

LLIOServerSocket

Definition at line 484 of file lliosocket.cpp.

References LLMemType::MTYPE_IO_TCP.

LLIOServerSocket::~LLIOServerSocket (  )  [virtual]

Definition at line 497 of file lliosocket.cpp.

References LLMemType::MTYPE_IO_TCP.


Member Function Documentation

LLIOPipe::EStatus LLIOServerSocket::process_impl ( const LLChannelDescriptors channels,
buffer_ptr_t buffer,
bool &  eos,
LLSD context,
LLPumpIO pump 
) [protected, virtual]

Process the data in buffer.

Definition at line 509 of file lliosocket.cpp.

References LLPumpIO::addChain(), LLSocket::create(), lldebugs, llendl, llwarns, mInitialized, mListenSocket, mPool, mReactor, mResponseTimeout, LLMemType::MTYPE_IO_TCP, NULL, PUMP_DEBUG, LLPumpIO::setConditional(), LLIOPipe::STATUS_ERROR, and LLIOPipe::STATUS_OK.

void LLIOServerSocket::setResponseTimeout ( F32  timeout_secs  ) 

Set the timeout for the generated chains.

This value is passed directly to the LLPumpIO::addChain() method. The default on construction is set to DEFAULT_CHAIN_EXPIRY_SECS which is a reasonable value for most applications based on this library. Avoid passing in NEVER_CHAIN_EXPIRY_SECS unless you have another method of harvesting chains.

Parameters:
timeout_secs The seconds before timeout for the response chain.

Definition at line 503 of file lliosocket.cpp.

References mResponseTimeout.


Member Data Documentation

bool LLIOServerSocket::mInitialized [protected]

Definition at line 336 of file lliosocket.h.

Referenced by process_impl().

socket_t LLIOServerSocket::mListenSocket [protected]

Definition at line 334 of file lliosocket.h.

Referenced by process_impl().

apr_pool_t* LLIOServerSocket::mPool [protected]

Definition at line 333 of file lliosocket.h.

Referenced by process_impl().

factory_t LLIOServerSocket::mReactor [protected]

Definition at line 335 of file lliosocket.h.

Referenced by process_impl().

F32 LLIOServerSocket::mResponseTimeout [protected]

Definition at line 337 of file lliosocket.h.

Referenced by process_impl(), and setResponseTimeout().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:26 2010 for Second Life Viewer by  doxygen 1.4.7