diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2009-01-13 19:08:29 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2009-01-13 19:08:29 +0000 |
| commit | 5fec8f487c510e2309b3bc939fea70078a11af97 (patch) | |
| tree | f875a150066a08094eba72856de99e471185a0aa /cpp/src/qpid/client/ConnectionHandler.cpp | |
| parent | 77bde150020c6c34130523f528d739c264aa12e3 (diff) | |
| download | qpid-python-5fec8f487c510e2309b3bc939fea70078a11af97.tar.gz | |
Send heartbeat from broker to client
- Server sends possible heartbeat range and client replies with desired
heartbeat as part of the tune-tuneOk exchange
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@734220 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/ConnectionHandler.cpp')
| -rw-r--r-- | cpp/src/qpid/client/ConnectionHandler.cpp | 17 |
1 files changed, 15 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); } |
