RSB
0.15.1
|
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 | shutdown () |
void | startReceiving () |
void | sendEvent (EventPtr event, const std::string &wireSchema) |
virtual const std::string | getTransportURL () const |
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 |
void | disconnect () |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
SocketPtr | socket |
WeakBusPtr | bus |
volatile bool | disconnecting |
volatile bool | activeShutdown |
boost::recursive_mutex | mutex |
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 74 of file BusConnection.h.
typedef boost::shared_ptr<boost::asio::ip::tcp::socket> rsb::transport::socket::BusConnection::SocketPtr |
Definition at line 77 of file BusConnection.h.
|
private |
Definition at line 95 of file BusConnection.h.
rsb::transport::socket::BusConnection::BusConnection | ( | BusPtr | bus, |
SocketPtr | socket, | ||
bool | client, | ||
bool | tcpNoDelay = false |
||
) |
Definition at line 60 of file BusConnection.cpp.
References lengthReceiveBuffer, lengthSendBuffer, and logger.
rsb::transport::socket::BusConnection::~BusConnection | ( | ) |
Definition at line 87 of file BusConnection.cpp.
References performSafeCleanup().
|
private |
Definition at line 105 of file BusConnection.cpp.
References disconnecting, logger, mutex, and socket.
Referenced by performSafeCleanup().
|
virtual |
Definition at line 283 of file BusConnection.cpp.
References socket.
|
private |
Definition at line 239 of file BusConnection.cpp.
References bus, disconnecting, logger, messageReceiveBuffer, notification, rsb::transport::socket::notificationToEvent(), performSafeCleanup(), and receiveEvent().
Referenced by handleReadLength().
|
private |
Definition at line 188 of file BusConnection.cpp.
References activeShutdown, disconnecting, handleReadBody(), lengthReceiveBuffer, logger, messageReceiveBuffer, mutex, performSafeCleanup(), rsb::transport::socket::safeSocketExceptionString(), shutdown(), and socket.
Referenced by receiveEvent().
|
private |
Definition at line 156 of file BusConnection.cpp.
References bus, disconnect(), disconnecting, logger, and rsb::transport::socket::safeSocketExceptionString().
Referenced by handleReadBody(), handleReadLength(), and ~BusConnection().
|
private |
Definition at line 274 of file BusConnection.cpp.
References socket.
|
private |
Definition at line 180 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 121 of file BusConnection.cpp.
References activeShutdown, rsb::transport::socket::eventToNotification(), lengthSendBuffer, logger, messageSendBuffer, mutex, notification, and socket.
void rsb::transport::socket::BusConnection::shutdown | ( | ) |
Definition at line 93 of file BusConnection.cpp.
References activeShutdown, logger, mutex, and socket.
Referenced by handleReadLength().
void rsb::transport::socket::BusConnection::startReceiving | ( | ) |
Definition at line 117 of file BusConnection.cpp.
References receiveEvent().
|
private |
Definition at line 104 of file BusConnection.h.
Referenced by handleReadLength(), sendEvent(), and shutdown().
|
private |
Definition at line 101 of file BusConnection.h.
Referenced by handleReadBody(), and performSafeCleanup().
|
private |
Definition at line 103 of file BusConnection.h.
Referenced by disconnect(), handleReadBody(), handleReadLength(), and performSafeCleanup().
|
private |
Definition at line 110 of file BusConnection.h.
Referenced by BusConnection(), handleReadLength(), and receiveEvent().
|
private |
Definition at line 114 of file BusConnection.h.
Referenced by BusConnection(), and sendEvent().
|
private |
Definition at line 97 of file BusConnection.h.
Referenced by BusConnection(), disconnect(), handleReadBody(), handleReadLength(), performSafeCleanup(), sendEvent(), and shutdown().
|
private |
Definition at line 111 of file BusConnection.h.
Referenced by handleReadBody(), and handleReadLength().
|
private |
Definition at line 115 of file BusConnection.h.
Referenced by sendEvent().
|
private |
Definition at line 106 of file BusConnection.h.
Referenced by disconnect(), handleReadLength(), sendEvent(), and shutdown().
|
private |
Definition at line 109 of file BusConnection.h.
Referenced by handleReadBody(), and sendEvent().
|
private |
Definition at line 99 of file BusConnection.h.
Referenced by disconnect(), getTransportURL(), handleReadLength(), printContents(), receiveEvent(), sendEvent(), and shutdown().