diff options
Diffstat (limited to 'cpp/src/qpid/client')
| -rw-r--r-- | cpp/src/qpid/client/ConnectionHandler.cpp | 17 | ||||
| -rw-r--r-- | cpp/src/qpid/client/ConnectionHandler.h | 1 |
2 files changed, 16 insertions, 2 deletions
diff --git a/cpp/src/qpid/client/ConnectionHandler.cpp b/cpp/src/qpid/client/ConnectionHandler.cpp index 2a070ebcff..d5b3f2264b 100644 --- a/cpp/src/qpid/client/ConnectionHandler.cpp +++ b/cpp/src/qpid/client/ConnectionHandler.cpp @@ -133,6 +133,13 @@ void ConnectionHandler::close() } } +void ConnectionHandler::heartbeat() +{ + // Do nothing - the purpose of heartbeats is just to make sure that there is some + // traffic on the connection within the heart beat interval, we check for the + // traffic and don't need to do anything in response to heartbeats +} + void ConnectionHandler::checkState(STATES s, const std::string& msg) { if (getState() != s) { @@ -195,13 +202,19 @@ void ConnectionHandler::secure(const std::string& challenge) } void ConnectionHandler::tune(uint16_t maxChannelsProposed, uint16_t maxFrameSizeProposed, - uint16_t /*heartbeatMin*/, uint16_t /*heartbeatMax*/) + uint16_t heartbeatMin, uint16_t heartbeatMax) { checkState(NEGOTIATING, INVALID_STATE_TUNE); maxChannels = std::min(maxChannels, maxChannelsProposed); maxFrameSize = std::min(maxFrameSize, maxFrameSizeProposed); - //TODO: implement heartbeats and check desired value is in valid range + // Clip the requested heartbeat to the maximum/minimum offered + uint16_t heartbeat = ConnectionSettings::heartbeat; + heartbeat = heartbeat < heartbeatMin ? heartbeatMin : + heartbeat > heartbeatMax ? heartbeatMax : + heartbeat; proxy.tuneOk(maxChannels, maxFrameSize, heartbeat); + // TODO set connection timeout to be 2x heart beat interval + // TODO and set an alarm for it. setState(OPENING); proxy.open(virtualhost, capabilities, insist); } diff --git a/cpp/src/qpid/client/ConnectionHandler.h b/cpp/src/qpid/client/ConnectionHandler.h index ec9278626f..58b540cfeb 100644 --- a/cpp/src/qpid/client/ConnectionHandler.h +++ b/cpp/src/qpid/client/ConnectionHandler.h @@ -86,6 +86,7 @@ class ConnectionHandler : private StateManager, const framing::Array& knownHosts); void close(uint16_t replyCode, const std::string& replyText); void closeOk(); + void heartbeat(); public: using InputHandler::handle; |
