added onAttached() and onDetached() to the TcpHandler interface
This commit is contained in:
parent
c52e8ff0b2
commit
8546f52cd0
|
|
@ -43,6 +43,18 @@ private:
|
||||||
* @var Connection
|
* @var Connection
|
||||||
*/
|
*/
|
||||||
Connection _connection;
|
Connection _connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that is called after the connection was constructed
|
||||||
|
* @param connection The connection that was attached to the handler
|
||||||
|
*/
|
||||||
|
virtual void onAttached(Connection *connection) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that is called when the connection is destructed
|
||||||
|
* @param connection The connection that was detached from the handler
|
||||||
|
*/
|
||||||
|
virtual void onDetached(Connection *connection) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method that is called when the heartbeat frequency is negotiated.
|
* Method that is called when the heartbeat frequency is negotiated.
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,30 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~TcpHandler() = default;
|
virtual ~TcpHandler() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that is called immediately after a connection has been constructed.
|
||||||
|
* @param connection The connection object that was just constructed
|
||||||
|
*
|
||||||
|
* @see ConnectionHandler::onAttached
|
||||||
|
*/
|
||||||
|
virtual void onAttached(TcpConnection *connection)
|
||||||
|
{
|
||||||
|
// make sure compilers dont complain about unused parameters
|
||||||
|
(void) connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that is called right before a connection object is destructed.
|
||||||
|
* @param connection The connection that is being destructed
|
||||||
|
*
|
||||||
|
* @see ConnectionHandler::onDetached
|
||||||
|
*/
|
||||||
|
virtual void onDetached(TcpConnection *connection)
|
||||||
|
{
|
||||||
|
// make sure compilers dont complain about unused parameters
|
||||||
|
(void) connection;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method that is called after a TCP connection has been set up and the initial
|
* Method that is called after a TCP connection has been set up and the initial
|
||||||
* TLS handshake is finished too, but right before the AMQP login handshake is
|
* TLS handshake is finished too, but right before the AMQP login handshake is
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,26 @@ void TcpConnection::flush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that is called after the connection was constructed
|
||||||
|
* @param connection The connection that was attached to the handler
|
||||||
|
*/
|
||||||
|
void TcpConnection::onAttached(Connection *connection)
|
||||||
|
{
|
||||||
|
// pass on to the state
|
||||||
|
_state->reportAttached();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that is called when the connection is destructed
|
||||||
|
* @param connection The connection that was detached from the handler
|
||||||
|
*/
|
||||||
|
void TcpConnection::onDetached(Connection *connection)
|
||||||
|
{
|
||||||
|
// pass on to the state
|
||||||
|
_state->reportDetached();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method that is called when the heartbeat frequency is negotiated.
|
* Method that is called when the heartbeat frequency is negotiated.
|
||||||
* @param connection The connection that suggested a heartbeat interval
|
* @param connection The connection that suggested a heartbeat interval
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,24 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual TcpState *flush(const Monitor &monitor) { return this; }
|
virtual TcpState *flush(const Monitor &monitor) { return this; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Report to the handler that the connection was constructed
|
||||||
|
*/
|
||||||
|
virtual void reportAttached()
|
||||||
|
{
|
||||||
|
// pass to the handler
|
||||||
|
_handler->onAttached(_connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Report to the handler that the connection was destructed
|
||||||
|
*/
|
||||||
|
virtual void reportDetached()
|
||||||
|
{
|
||||||
|
// pass to the handler
|
||||||
|
_handler->onDetached(_connection);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report to the handler that heartbeat negotiation is going on
|
* Report to the handler that heartbeat negotiation is going on
|
||||||
* @param heartbeat suggested heartbeat
|
* @param heartbeat suggested heartbeat
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue