Sirikata
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
Sirikata::Network::MultiplexedSocket Class Reference

#include <MultiplexedSocket.hpp>

Inheritance diagram for Sirikata::Network::MultiplexedSocket:
Collaboration diagram for Sirikata::Network::MultiplexedSocket:

List of all members.

Classes

class  RawRequest
class  StreamIDCallbackPair
 Workaround for VC8 bug that does not define std::pair<Stream::StreamID,Callbacks*>::operator=. More...

Public Types

enum  SocketConnectionPhase { PRECONNECTION, WAITCONNECTING, CONNECTED, DISCONNECTED }

Public Member Functions

TCPStream::StreamType getStreamType () const
IOStrandgetStrand ()
 public io service accessor for new stream construction
bool canSendBytes (Stream::StreamID origin, size_t dataSize) const
 Finds if there is enough space to enqueue the particular bytes at this moment.
SocketConnectionPhase addCallbacks (const Stream::StreamID &sid, TCPStream::Callbacks *cb)
 Adds callbacks onto the queue of callbacks-to-be-added Returns true if the callbacks will be actually used or false if the socket is already disconnected.
Stream::StreamID getNewID ()
 function that searches mFreeStreamIDs or uses the mHighestStreamID to find the next unused free stream ID
 MultiplexedSocket (IOStrand *io, const Stream::SubstreamCallback &substreamCallback, TCPStream::StreamType type)
 Constructor for a connecting stream.
 MultiplexedSocket (IOStrand *io, const UUID &uuid, const Stream::SubstreamCallback &substreamCallback, TCPStream::StreamType type)
 Constructor for a listening stream with a prebuilt connection of ASIO sockets.
void initFromSockets (const std::vector< TCPSocket * > &sockets, size_t max_send_buffer_size)
 call after construction to setup mSockets
 ~MultiplexedSocket ()
 erase all sockets and callbacks since the refcount is now zero;
void shutDownClosedStream (unsigned int controlCode, const Stream::StreamID &id)
 a stream that has been closed and the other side has agreed not to send any more packets using that ID
void receiveFullChunk (unsigned int whichSocket, Stream::StreamID id, Chunk &newChunk, const Stream::PauseReceiveCallback &pauseReceive)
 Process an entire packet when received from the IO reactor thread.
void receivePing (unsigned int whichSocket, MemoryReference data, bool isPong)
 Process a socket-level ping.
void connectionFailedCallback (unsigned int whichSocket, const std::string &error)
 The a particular socket's connection failed This function will call all substreams disconnected methods.
template<class ErrorCode >
void connectionFailedCallback (const ErrorCode &error)
 The connection failed to connect before any sockets had been established (ex: host not found) This function will call all substreams disconnected methods.
template<class ErrorCode >
void connectionFailedCallback (unsigned int whichSocket, const ErrorCode &error)
 The a particular socket's connection failed This function will call all substreams disconnected methods.
template<class ErrorCode >
void connectionFailedCallback (const ASIOSocketWrapper *whichSocket, const ErrorCode &error)
 The a particular socket's connection failed This function will call all substreams disconnected methods.
void hostDisconnectedCallback (unsigned int whichSocket, const std::string &error)
 The a particular socket's connection failed This function will call all substreams disconnected methods.
template<class ErrorCode >
void hostDisconnectedCallback (unsigned int whichSocket, const ErrorCode &error)
 The a particular socket's connection failed This function will call all substreams disconnected methods.
template<class ErrorCode >
void hostDisconnectedCallback (const ASIOSocketWrapper *whichSocket, const ErrorCode &error)
 The a particular socket's connection failed This function will call all substreams disconnected methods.
void connectedCallback ()
 The a particular established a connection: This function will call all substreams connected methods.
void unpauseSendStreams (const std::vector< Stream::StreamID > &toUnpause)
void connect (const Address &address, unsigned int numSockets, size_t maxEnqueuedSendSize, bool noDelay, unsigned int kernelSendBufferSize, unsigned int kernelReceiveBufferSize)
 Connect a newly constructed MultiplexedSocket to a given address.
void prepareConnect (unsigned int numSockets, size_t maxEnqueuedSendSize, bool noDelay, unsigned int kernelSendBufferSize, unsigned int kernelReceiveBufferSize)
 Prepare a socket for an outbound connection.
unsigned int numSockets () const
ASIOSocketWrappergetASIOSocketWrapper (unsigned int whichSocket)
const ASIOSocketWrappergetASIOSocketWrapper (unsigned int whichSocket) const
Address getRemoteEndpoint (Stream::StreamID id) const
Address getLocalEndpoint (Stream::StreamID id) const
Duration averageSendLatency () const
Duration averageReceiveLatency () const

Static Public Member Functions

static void closeStream (const MultiplexedSocketPtr &thus, const Stream::StreamID &sid, TCPStream::TCPStreamControlCodes code=TCPStream::TCPStreamCloseStream)
 Sends a packet telling the other side that this stream is closed (or alternatively if its a closeAck that the close request was received and no further packets for that stream will be sent with that streamID.
static bool sendBytes (const MultiplexedSocketPtr &thus, const RawRequest &data, unsigned int maxSendQueueSize=2147483647)
 Either sends or queues bytes in the data request depending on the connection state if the state is not connected then it must take a lock and place them on the mNewRequests queue.
static Stream::StreamID getFirstStreamID (bool connector)
 gets the first stream ID for a newly created stream
static void sendAllProtocolHeaders (const MultiplexedSocketPtr &thus, const std::string &origin, const std::string &host, const std::string &port, const std::string &resource_name, const std::string &subprotocol, bool doSendSubProtocol, const std::map< TCPSocket *, std::string > &response, TCPStream::StreamType streamType)
 Sends the protocol headers to all ASIO socket wrappers when a known fully open connection has been listened for.
static void ioReactorThreadResumeRead (const MultiplexedSocketWPtr &, Stream::StreamID id)
static void ioReactorThreadPauseSend (const MultiplexedSocketWPtr &mp, Stream::StreamID id)

Private Types

typedef
std::tr1::unordered_map
< Stream::StreamID,
TCPStream::Callbacks
*, Stream::StreamID::Hasher > 
CallbackMap

Private Member Functions

void ioReactorThreadCommitCallback (StreamIDCallbackPair &newcallback)
 Copies items from newcallback to mCallbacks: must be called from the single io thread so no one would be looking to call the callbacks at the same time.
bool CommitCallbacks (std::deque< StreamIDCallbackPair > &registration, SocketConnectionPhase status, bool setConnectedStatus=false)
 reads the current list of id-callback pairs to the registration list and if setConectedStatus is set, changes the status of the overall MultiplexedSocket at the same time
size_t leastBusyStream (size_t preferredStream)
 Returns the least busy stream upon which unordered data may be piled. It will always favor preferred stream if that is less busy.
float dropChance (const Chunk *data, size_t whichStream)
 chance in the current load that an unreliable packet may be dropped (due to busy queues, etc).
void connectionFailureOrSuccessCallback (SocketConnectionPhase status, Stream::ConnectionStatus reportedProblem, const std::string &errorMessage=std::string())
 Calls the connected callback with the succeess or failure status.
void connectionFailedCallback (const std::string &error)
 The connection failed before any sockets were established (or as a helper function after they have been cleaned) This function will call all substreams disconnected methods.
void hostDisconnectedCallback (const std::string &error)
 The connection failed before any sockets were established (or as a helper function after they have been cleaned) This function will call all substreams disconnected methods.

Static Private Member Functions

static bool sendBytesNow (const MultiplexedSocketPtr &thus, const RawRequest &data, bool force)
 sends bytes to the network directly.

Private Attributes

IOStrandmIO
 ASIO strand which guarantees serialized callbacks.
std::vector< ASIOSocketWrappermSockets
 a vector of ASIO sockets (wrapped in with a simple send-full-packet abstraction)
Stream::SubstreamCallback mNewSubstreamCallback
 This callback is called whenever a newly encountered StreamID is picked up.
SizedThreadSafeQueue
< RawRequest > * 
mNewRequests
 list of packets that must be sent before mSocketConnectionPhase switches to CONNECTION
volatile SocketConnectionPhase mSocketConnectionPhase
 must be set to PRECONNECTION when items are being placed on mNewRequests queue and WAITCONNECTING when it is emptying the queue (with lock held) and finally CONNECTED when the user can send directly to the socket. DISCONNECTED must be set as soon as the socket fails to write or read
std::deque< StreamIDCallbackPairmCallbackRegistration
 This is a list of items for callback registration so that when packets are received by those streamIDs the appropriate callback may be called.
CallbackMap mCallbacks
 a map of ID to callback, only to be touched by the io reactor thread
TCPStream::StreamType mStreamType
 Whether the streams are zero delimited and in a base64 encoding (useful for interaction with web sockets)
std::tr1::unordered_map
< Stream::StreamID, unsigned
int, Stream::StreamID::Hasher > 
mAckedClosingStreams
 a map from StreamID to count of number of acked close requests--to avoid any unordered packets coming in
std::tr1::unordered_set
< Stream::StreamID,
Stream::StreamID::Hasher > 
mOneSidedClosingStreams
 a set of StreamIDs to hold the streams that were requested closed but have not been acknowledged, to prevent received packets triggering NewStream callbacks as if a new ID were received
AtomicValue< uint32 > mHighestStreamID
 The highest streamID that has been used for making new streams on this side.
ThreadSafeStack< Stream::StreamIDmFreeStreamIDs
 actually free stream IDs that will not be sent out until recalimed by this side

Static Private Attributes

static boost::mutex sConnectingMutex
 these next items (mCallbackRegistration, mNewRequests, mSocketConnectionPhase) are synced together take the lock, check for preconnection,,, if connected, don't take lock...otherwise take lock and push data onto the new requests queue

Friends

class ASIOReadBuffer

Member Typedef Documentation

typedef std::tr1::unordered_map<Stream::StreamID,TCPStream::Callbacks*,Stream::StreamID::Hasher> Sirikata::Network::MultiplexedSocket::CallbackMap [private]

Member Enumeration Documentation

Enumerator:
PRECONNECTION 
WAITCONNECTING 
CONNECTED 
DISCONNECTED 

Constructor & Destructor Documentation

Sirikata::Network::MultiplexedSocket::MultiplexedSocket ( IOStrand io,
const Stream::SubstreamCallback substreamCallback,
TCPStream::StreamType  type 
)

Constructor for a connecting stream.

References mNewRequests, mSocketConnectionPhase, mStreamType, and PRECONNECTION.

Sirikata::Network::MultiplexedSocket::MultiplexedSocket ( IOStrand io,
const UUID uuid,
const Stream::SubstreamCallback substreamCallback,
TCPStream::StreamType  type 
)

Constructor for a listening stream with a prebuilt connection of ASIO sockets.

References mNewRequests, mSocketConnectionPhase, mStreamType, and PRECONNECTION.

Sirikata::Network::MultiplexedSocket::~MultiplexedSocket ( )

Member Function Documentation

MultiplexedSocket::SocketConnectionPhase Sirikata::Network::MultiplexedSocket::addCallbacks ( const Stream::StreamID sid,
TCPStream::Callbacks cb 
)

Adds callbacks onto the queue of callbacks-to-be-added Returns true if the callbacks will be actually used or false if the socket is already disconnected.

References mCallbackRegistration, mSocketConnectionPhase, and sConnectingMutex.

Referenced by Sirikata::Network::TCPSetCallbacks::operator()().

Duration Sirikata::Network::MultiplexedSocket::averageReceiveLatency ( ) const

References mSockets.

Duration Sirikata::Network::MultiplexedSocket::averageSendLatency ( ) const

References mSockets.

bool Sirikata::Network::MultiplexedSocket::canSendBytes ( Stream::StreamID  origin,
size_t  dataSize 
) const

Finds if there is enough space to enqueue the particular bytes at this moment.

References CONNECTED, mSocketConnectionPhase, and mSockets.

void Sirikata::Network::MultiplexedSocket::closeStream ( const MultiplexedSocketPtr thus,
const Stream::StreamID sid,
TCPStream::TCPStreamControlCodes  code = TCPStream::TCPStreamCloseStream 
) [static]

Sends a packet telling the other side that this stream is closed (or alternatively if its a closeAck that the close request was received and no further packets for that stream will be sent with that streamID.

References Sirikata::Network::ASIOSocketWrapper::constructControlPacket(), Sirikata::Network::MultiplexedSocket::RawRequest::data, Sirikata::Network::MultiplexedSocket::RawRequest::originStream, sendBytes(), Sirikata::Network::MultiplexedSocket::RawRequest::unordered, and Sirikata::Network::MultiplexedSocket::RawRequest::unreliable.

Referenced by Sirikata::Network::TCPStream::close(), and receiveFullChunk().

bool Sirikata::Network::MultiplexedSocket::CommitCallbacks ( std::deque< StreamIDCallbackPair > &  registration,
SocketConnectionPhase  status,
bool  setConnectedStatus = false 
) [private]
void Sirikata::Network::MultiplexedSocket::connect ( const Address address,
unsigned int  numSockets,
size_t  maxEnqueuedSendSize,
bool  noDelay,
unsigned int  kernelSendBufferSize,
unsigned int  kernelReceiveBufferSize 
)

Connect a newly constructed MultiplexedSocket to a given address.

Parameters:
addressis a protocol-agnostic string of endpoint and service ID
numSocketsindicates how many TCP sockets should manage the orderlessness of this connection
maxEnqueuedSendSizethe maximum number of enqueued bytes for sending that have not been committed to the underlying network implementation.
noDelayif true, disables Nagle's algorithm on the underling sockets.
kernelSendBufferSizethe size of the buffer allocated for sending data in the underlying networking implementation. Note that this is additional space on top of that allocated by this library.
kernelReceiveBufferSizethe size of the buffer allocated for receiving data in the underlying networking implementation. Note that this is additional space on top of that allocated by this library.

References Sirikata::SelfWeakPtr< MultiplexedSocket >::getSharedPtr(), prepareConnect(), and Sirikata::UUID::random().

void Sirikata::Network::MultiplexedSocket::connectedCallback ( ) [inline]

The a particular established a connection: This function will call all substreams connected methods.

References Sirikata::Network::Stream::Connected, CONNECTED, and connectionFailureOrSuccessCallback().

void Sirikata::Network::MultiplexedSocket::connectionFailedCallback ( unsigned int  whichSocket,
const std::string &  error 
)

The a particular socket's connection failed This function will call all substreams disconnected methods.

References connectionFailedCallback().

template<class ErrorCode >
void Sirikata::Network::MultiplexedSocket::connectionFailedCallback ( const ErrorCode &  error) [inline]

The connection failed to connect before any sockets had been established (ex: host not found) This function will call all substreams disconnected methods.

References connectionFailedCallback().

void Sirikata::Network::MultiplexedSocket::connectionFailedCallback ( const std::string &  error) [private]

The connection failed before any sockets were established (or as a helper function after they have been cleaned) This function will call all substreams disconnected methods.

References Sirikata::Network::Stream::ConnectionFailed, connectionFailureOrSuccessCallback(), and DISCONNECTED.

Referenced by connectionFailedCallback().

template<class ErrorCode >
void Sirikata::Network::MultiplexedSocket::connectionFailedCallback ( unsigned int  whichSocket,
const ErrorCode &  error 
) [inline]

The a particular socket's connection failed This function will call all substreams disconnected methods.

References connectionFailedCallback().

template<class ErrorCode >
void Sirikata::Network::MultiplexedSocket::connectionFailedCallback ( const ASIOSocketWrapper whichSocket,
const ErrorCode &  error 
) [inline]

The a particular socket's connection failed This function will call all substreams disconnected methods.

References connectionFailedCallback(), and mSockets.

void Sirikata::Network::MultiplexedSocket::connectionFailureOrSuccessCallback ( SocketConnectionPhase  status,
Stream::ConnectionStatus  reportedProblem,
const std::string &  errorMessage = std::string() 
) [private]

Calls the connected callback with the succeess or failure status.

Sets status while holding the sConnectingMutex lock so that after that point no more Connected responses will be sent out. Then inserts the registrations into the mCallbacks map during the ioReactor thread.

References CommitCallbacks(), Sirikata::Network::Stream::Connected, Sirikata::Network::Stream::ignoreConnectionCallback(), and mCallbacks.

Referenced by connectedCallback(), connectionFailedCallback(), and hostDisconnectedCallback().

float Sirikata::Network::MultiplexedSocket::dropChance ( const Chunk data,
size_t  whichStream 
) [private]

chance in the current load that an unreliable packet may be dropped (due to busy queues, etc).

Returns:
drop chance which must be less than 1.0 and greater or equal to 0.0
ASIOSocketWrapper& Sirikata::Network::MultiplexedSocket::getASIOSocketWrapper ( unsigned int  whichSocket) [inline]
const ASIOSocketWrapper& Sirikata::Network::MultiplexedSocket::getASIOSocketWrapper ( unsigned int  whichSocket) const [inline]

References mSockets.

Stream::StreamID Sirikata::Network::MultiplexedSocket::getFirstStreamID ( bool  connector) [static]
Address Sirikata::Network::MultiplexedSocket::getLocalEndpoint ( Stream::StreamID  id) const
Stream::StreamID Sirikata::Network::MultiplexedSocket::getNewID ( )

function that searches mFreeStreamIDs or uses the mHighestStreamID to find the next unused free stream ID

References mFreeStreamIDs, and mHighestStreamID.

Address Sirikata::Network::MultiplexedSocket::getRemoteEndpoint ( Stream::StreamID  id) const
IOStrand* Sirikata::Network::MultiplexedSocket::getStrand ( ) [inline]

public io service accessor for new stream construction

References mIO.

TCPStream::StreamType Sirikata::Network::MultiplexedSocket::getStreamType ( ) const [inline]

References mStreamType.

template<class ErrorCode >
void Sirikata::Network::MultiplexedSocket::hostDisconnectedCallback ( unsigned int  whichSocket,
const ErrorCode &  error 
) [inline]

The a particular socket's connection failed This function will call all substreams disconnected methods.

References hostDisconnectedCallback().

void Sirikata::Network::MultiplexedSocket::hostDisconnectedCallback ( const std::string &  error) [private]

The connection failed before any sockets were established (or as a helper function after they have been cleaned) This function will call all substreams disconnected methods.

References connectionFailureOrSuccessCallback(), Sirikata::Network::Stream::Disconnected, and DISCONNECTED.

Referenced by hostDisconnectedCallback(), Sirikata::Network::ASIOReadBuffer::processError(), and Sirikata::Network::triggerMultiplexedConnectionError().

void Sirikata::Network::MultiplexedSocket::hostDisconnectedCallback ( unsigned int  whichSocket,
const std::string &  error 
)

The a particular socket's connection failed This function will call all substreams disconnected methods.

References hostDisconnectedCallback().

template<class ErrorCode >
void Sirikata::Network::MultiplexedSocket::hostDisconnectedCallback ( const ASIOSocketWrapper whichSocket,
const ErrorCode &  error 
) [inline]

The a particular socket's connection failed This function will call all substreams disconnected methods.

References hostDisconnectedCallback(), and mSockets.

void Sirikata::Network::MultiplexedSocket::initFromSockets ( const std::vector< TCPSocket * > &  sockets,
size_t  max_send_buffer_size 
)

call after construction to setup mSockets

References ASIO_SEND_BUFFER_SIZE, Sirikata::SelfWeakPtr< MultiplexedSocket >::getSharedPtr(), and mSockets.

void Sirikata::Network::MultiplexedSocket::ioReactorThreadCommitCallback ( StreamIDCallbackPair newcallback) [private]

Copies items from newcallback to mCallbacks: must be called from the single io thread so no one would be looking to call the callbacks at the same time.

References Sirikata::Logging::error, Sirikata::Network::MultiplexedSocket::StreamIDCallbackPair::mCallback, mCallbacks, Sirikata::Network::MultiplexedSocket::StreamIDCallbackPair::mID, mOneSidedClosingStreams, Sirikata::Network::MultiplexedSocket::StreamIDCallbackPair::pair(), and SILOG.

Referenced by CommitCallbacks().

void Sirikata::Network::MultiplexedSocket::ioReactorThreadPauseSend ( const MultiplexedSocketWPtr mp,
Stream::StreamID  id 
) [static]
void Sirikata::Network::MultiplexedSocket::ioReactorThreadResumeRead ( const MultiplexedSocketWPtr weak_thus,
Stream::StreamID  id 
) [static]
size_t Sirikata::Network::MultiplexedSocket::leastBusyStream ( size_t  preferredStream) [private]

Returns the least busy stream upon which unordered data may be piled. It will always favor preferred stream if that is less busy.

References mSockets.

unsigned int Sirikata::Network::MultiplexedSocket::numSockets ( ) const [inline]

References mSockets.

Referenced by prepareConnect(), and sendAllProtocolHeaders().

void Sirikata::Network::MultiplexedSocket::prepareConnect ( unsigned int  numSockets,
size_t  maxEnqueuedSendSize,
bool  noDelay,
unsigned int  kernelSendBufferSize,
unsigned int  kernelReceiveBufferSize 
)

Prepare a socket for an outbound connection.

After this call messages may be queued and number of redundant connections set Additionally this socket may now be cloned

References ASIO_SEND_BUFFER_SIZE, Sirikata::SelfWeakPtr< MultiplexedSocket >::getSharedPtr(), mSocketConnectionPhase, mSockets, numSockets(), and PRECONNECTION.

Referenced by connect().

void Sirikata::Network::MultiplexedSocket::receiveFullChunk ( unsigned int  whichSocket,
Stream::StreamID  id,
Chunk newChunk,
const Stream::PauseReceiveCallback pauseReceive 
)
void Sirikata::Network::MultiplexedSocket::receivePing ( unsigned int  whichSocket,
MemoryReference  data,
bool  isPong 
)

Process a socket-level ping.

If expectPong, send a pong as a reply.

References Sirikata::Network::ASIOSocketWrapper::constructPing(), Sirikata::SelfWeakPtr< MultiplexedSocket >::getSharedPtr(), and mSockets.

void Sirikata::Network::MultiplexedSocket::sendAllProtocolHeaders ( const MultiplexedSocketPtr thus,
const std::string &  origin,
const std::string &  host,
const std::string &  port,
const std::string &  resource_name,
const std::string &  subprotocol,
bool  doSendSubProtocol,
const std::map< TCPSocket *, std::string > &  response,
TCPStream::StreamType  streamType 
) [static]

Sends the protocol headers to all ASIO socket wrappers when a known fully open connection has been listened for.

References CONNECTED, Sirikata::Network::MakeASIOReadBuffer(), numSockets(), and sConnectingMutex.

Referenced by Sirikata::Network::ASIOStreamBuilder::buildStream().

bool Sirikata::Network::MultiplexedSocket::sendBytes ( const MultiplexedSocketPtr thus,
const RawRequest data,
unsigned int  maxSendQueueSize = 2147483647 
) [static]

Either sends or queues bytes in the data request depending on the connection state if the state is not connected then it must take a lock and place them on the mNewRequests queue.

References CONNECTED, Sirikata::Network::MultiplexedSocket::RawRequest::data, DISCONNECTED, PRECONNECTION, Sirikata::SizedThreadSafeQueue< T, ResourceMonitor, Superclass >::push(), sConnectingMutex, sendBytesNow(), and TCPSSTLOG.

Referenced by closeStream(), and Sirikata::Network::TCPStream::send().

bool Sirikata::Network::MultiplexedSocket::sendBytesNow ( const MultiplexedSocketPtr thus,
const RawRequest data,
bool  force 
) [static, private]
void Sirikata::Network::MultiplexedSocket::shutDownClosedStream ( unsigned int  controlCode,
const Stream::StreamID id 
)
void Sirikata::Network::MultiplexedSocket::unpauseSendStreams ( const std::vector< Stream::StreamID > &  toUnpause)

Friends And Related Function Documentation

friend class ASIOReadBuffer [friend]

Member Data Documentation

std::tr1::unordered_map<Stream::StreamID,unsigned int,Stream::StreamID::Hasher> Sirikata::Network::MultiplexedSocket::mAckedClosingStreams [private]

a map from StreamID to count of number of acked close requests--to avoid any unordered packets coming in

Referenced by receiveFullChunk().

This is a list of items for callback registration so that when packets are received by those streamIDs the appropriate callback may be called.

Referenced by addCallbacks(), CommitCallbacks(), and ~MultiplexedSocket().

a map of ID to callback, only to be touched by the io reactor thread

Referenced by connectionFailureOrSuccessCallback(), ioReactorThreadCommitCallback(), receiveFullChunk(), shutDownClosedStream(), unpauseSendStreams(), and ~MultiplexedSocket().

actually free stream IDs that will not be sent out until recalimed by this side

Referenced by getNewID(), and shutDownClosedStream().

The highest streamID that has been used for making new streams on this side.

Referenced by getNewID(), and shutDownClosedStream().

ASIO strand which guarantees serialized callbacks.

Referenced by getStrand().

list of packets that must be sent before mSocketConnectionPhase switches to CONNECTION

Referenced by CommitCallbacks(), MultiplexedSocket(), and ~MultiplexedSocket().

This callback is called whenever a newly encountered StreamID is picked up.

Referenced by receiveFullChunk(), and ~MultiplexedSocket().

std::tr1::unordered_set<Stream::StreamID,Stream::StreamID::Hasher> Sirikata::Network::MultiplexedSocket::mOneSidedClosingStreams [private]

a set of StreamIDs to hold the streams that were requested closed but have not been acknowledged, to prevent received packets triggering NewStream callbacks as if a new ID were received

Referenced by ioReactorThreadCommitCallback(), receiveFullChunk(), and shutDownClosedStream().

must be set to PRECONNECTION when items are being placed on mNewRequests queue and WAITCONNECTING when it is emptying the queue (with lock held) and finally CONNECTED when the user can send directly to the socket. DISCONNECTED must be set as soon as the socket fails to write or read

Referenced by addCallbacks(), canSendBytes(), CommitCallbacks(), getLocalEndpoint(), getRemoteEndpoint(), MultiplexedSocket(), and prepareConnect().

Whether the streams are zero delimited and in a base64 encoding (useful for interaction with web sockets)

Referenced by getStreamType(), and MultiplexedSocket().

these next items (mCallbackRegistration, mNewRequests, mSocketConnectionPhase) are synced together take the lock, check for preconnection,,, if connected, don't take lock...otherwise take lock and push data onto the new requests queue

Referenced by addCallbacks(), CommitCallbacks(), sendAllProtocolHeaders(), sendBytes(), and ~MultiplexedSocket().


The documentation for this class was generated from the following files: