RSB
0.7.0
|
Instances of this class implement connections to a socket-based bus. More...
#include <BusConnection.h>
Public Types | |
typedef boost::shared_ptr < boost::asio::ip::tcp::socket > | SocketPtr |
Public Member Functions | |
BusConnection (BusPtr bus, SocketPtr socket, bool client, bool tcpNoDelay=false) | |
~BusConnection () | |
void | disconnect () |
void | startReceiving () |
void | sendEvent (EventPtr event, const std::string &wireSchema) |
Private Types | |
typedef boost::weak_ptr< Bus > | WeakBusPtr |
Private Member Functions | |
void | performSafeCleanup (const std::string &context) |
void | receiveEvent () |
void | handleReadLength (const boost::system::error_code &error, size_t bytesTransferred) |
void | handleReadBody (const boost::system::error_code &error, size_t bytesTransferred, size_t expected) |
void | printContents (std::ostream &stream) const |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
SocketPtr | socket |
WeakBusPtr | bus |
volatile bool | disconnecting |
protocol::Notification | notification |
std::string | lengthReceiveBuffer |
std::string | messageReceiveBuffer |
std::string | lengthSendBuffer |
std::string | messageSendBuffer |
Instances of this class implement connections to a socket-based bus.
The basic operations provided by this class are receiving an event by calling receiveEvent and submitting an event to the bus by calling sendEvent.
In a process which acts as a client for a particular bus, a single instance of this class is connected to the remote bus server and provides access to the bus for all participants in the process.
A process which acts as the server for a particular bus, manages (via the BusServer class) one BusConnection object for each client (remote process) connected to the bus.
This class is not thread-safe.
Definition at line 72 of file BusConnection.h.
typedef boost::shared_ptr<boost::asio::ip::tcp::socket> rsb::transport::socket::BusConnection::SocketPtr |
Definition at line 75 of file BusConnection.h.
|
private |
Definition at line 91 of file BusConnection.h.
rsb::transport::socket::BusConnection::BusConnection | ( | BusPtr | bus, |
SocketPtr | socket, | ||
bool | client, | ||
bool | tcpNoDelay = false |
||
) |
Definition at line 49 of file BusConnection.cpp.
References lengthReceiveBuffer, lengthSendBuffer, and logger.
rsb::transport::socket::BusConnection::~BusConnection | ( | ) |
Definition at line 76 of file BusConnection.cpp.
References performSafeCleanup().
void rsb::transport::socket::BusConnection::disconnect | ( | ) |
Definition at line 80 of file BusConnection.cpp.
References disconnecting, logger, and socket.
Referenced by performSafeCleanup().
|
private |
Definition at line 179 of file BusConnection.cpp.
References disconnecting, logger, messageReceiveBuffer, notification, rsb::transport::socket::notificationToEvent(), performSafeCleanup(), and receiveEvent().
Referenced by handleReadLength().
|
private |
Definition at line 149 of file BusConnection.cpp.
References disconnecting, handleReadBody(), lengthReceiveBuffer, logger, messageReceiveBuffer, performSafeCleanup(), and socket.
Referenced by receiveEvent().
|
private |
Definition at line 119 of file BusConnection.cpp.
References bus, disconnect(), disconnecting, and logger.
Referenced by handleReadBody(), handleReadLength(), and ~BusConnection().
|
private |
Definition at line 214 of file BusConnection.cpp.
References socket.
|
private |
Definition at line 141 of file BusConnection.cpp.
References handleReadLength(), lengthReceiveBuffer, and socket.
Referenced by handleReadBody(), and startReceiving().
void rsb::transport::socket::BusConnection::sendEvent | ( | EventPtr | event, |
const std::string & | wireSchema | ||
) |
Definition at line 96 of file BusConnection.cpp.
References rsb::transport::socket::eventToNotification(), lengthSendBuffer, messageSendBuffer, notification, and socket.
void rsb::transport::socket::BusConnection::startReceiving | ( | ) |
Definition at line 92 of file BusConnection.cpp.
References receiveEvent().
|
private |
Definition at line 97 of file BusConnection.h.
Referenced by performSafeCleanup().
|
private |
Definition at line 99 of file BusConnection.h.
Referenced by disconnect(), handleReadBody(), handleReadLength(), and performSafeCleanup().
|
private |
Definition at line 103 of file BusConnection.h.
Referenced by BusConnection(), handleReadLength(), and receiveEvent().
|
private |
Definition at line 107 of file BusConnection.h.
Referenced by BusConnection(), and sendEvent().
|
private |
Definition at line 93 of file BusConnection.h.
Referenced by BusConnection(), disconnect(), handleReadBody(), handleReadLength(), and performSafeCleanup().
|
private |
Definition at line 104 of file BusConnection.h.
Referenced by handleReadBody(), and handleReadLength().
|
private |
Definition at line 108 of file BusConnection.h.
Referenced by sendEvent().
|
private |
Definition at line 102 of file BusConnection.h.
Referenced by handleReadBody(), and sendEvent().
|
private |
Definition at line 95 of file BusConnection.h.
Referenced by disconnect(), handleReadLength(), printContents(), receiveEvent(), and sendEvent().