LogCabin
|
An interface for handling events generated by a MessageSocket. More...
#include <MessageSocket.h>
Public Types | |
typedef MessageSocket::MessageId | MessageId |
Public Member Functions | |
virtual | ~Handler () |
Destructor. | |
virtual void | handleReceivedMessage (MessageId messageId, Core::Buffer contents)=0 |
This method is overridden by a subclass and invoked when a new message is received. | |
virtual void | handleDisconnect ()=0 |
This method is overridden by a subclass and invoked when the socket has been disconnected and will be closed soon. |
An interface for handling events generated by a MessageSocket.
The Handler's lifetime must outlive that of the MessageSocket.
Definition at line 65 of file MessageSocket.h.
Definition at line 67 of file MessageSocket.h.
virtual LogCabin::RPC::MessageSocket::Handler::~Handler | ( | ) | [inline, virtual] |
Destructor.
Definition at line 72 of file MessageSocket.h.
virtual void LogCabin::RPC::MessageSocket::Handler::handleReceivedMessage | ( | MessageId | messageId, |
Core::Buffer | contents | ||
) | [pure virtual] |
This method is overridden by a subclass and invoked when a new message is received.
This method will be invoked by the main event loop on whatever thread is running the Event::Loop.
messageId | An opaque identifier for the message set by the sender. |
contents | The data received. |
Implemented in LogCabin::RPC::ClientSession::MessageSocketHandler, and LogCabin::RPC::OpaqueServer::MessageSocketHandler.
virtual void LogCabin::RPC::MessageSocket::Handler::handleDisconnect | ( | ) | [pure virtual] |
This method is overridden by a subclass and invoked when the socket has been disconnected and will be closed soon.
It is safe to destroy the MessageSocket during this call. This method will be invoked by the main event loop at any time on whatever thread is running the Event::Loop.
Note that MessageSocket::close() calls this method as well, even if it's already been called.
Implemented in LogCabin::RPC::ClientSession::MessageSocketHandler, and LogCabin::RPC::OpaqueServer::MessageSocketHandler.