LogCabin
|
Receives events from a MessageSocket. More...
Public Member Functions | |
MessageSocketHandler (OpaqueServer *server) | |
void | handleReceivedMessage (MessageId messageId, Core::Buffer message) |
This method is overridden by a subclass and invoked when a new message is received. | |
void | handleDisconnect () |
This method is overridden by a subclass and invoked when the socket has been disconnected and will be closed soon. | |
MessageSocketHandler (const MessageSocketHandler &) | |
MessageSocketHandler & | operator= (const MessageSocketHandler &) |
Public Attributes | |
OpaqueServer * | server |
The OpaqueServer which keeps a strong reference to this object, or NULL if the server has been/is being destroyed. | |
std::weak_ptr< SocketWithHandler > | self |
A weak reference to this object, used to give OpaqueServerRPCs a way to send their replies back on their originating socket. |
Receives events from a MessageSocket.
Definition at line 121 of file OpaqueServer.h.
LogCabin::RPC::OpaqueServer::MessageSocketHandler::MessageSocketHandler | ( | OpaqueServer * | server | ) | [explicit] |
Definition at line 37 of file OpaqueServer.cc.
LogCabin::RPC::OpaqueServer::MessageSocketHandler::MessageSocketHandler | ( | const MessageSocketHandler & | ) |
void LogCabin::RPC::OpaqueServer::MessageSocketHandler::handleReceivedMessage | ( | MessageId | messageId, |
Core::Buffer | contents | ||
) | [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. |
Implements LogCabin::RPC::MessageSocket::Handler.
Definition at line 44 of file OpaqueServer.cc.
void LogCabin::RPC::OpaqueServer::MessageSocketHandler::handleDisconnect | ( | ) | [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.
Implements LogCabin::RPC::MessageSocket::Handler.
Definition at line 86 of file OpaqueServer.cc.
MessageSocketHandler& LogCabin::RPC::OpaqueServer::MessageSocketHandler::operator= | ( | const MessageSocketHandler & | ) |
The OpaqueServer which keeps a strong reference to this object, or NULL if the server has been/is being destroyed.
Used to invoke the server's rpcHandler when receiving an RPC request, or to drop the server's reference to this socket when disconnecting.
May only be accessed with an Event::Loop::Lock or from the event loop, since the OpaqueServer may set this to NULL under the same rules.
Definition at line 137 of file OpaqueServer.h.
A weak reference to this object, used to give OpaqueServerRPCs a way to send their replies back on their originating socket.
This may be empty when the SocketWithHandler is shutting down.
Definition at line 144 of file OpaqueServer.h.