diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2009-06-08 14:35:01 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2009-06-08 14:35:01 +0000 |
| commit | 477ef3c8435165fa70d6a19c195e4b14c4e6073f (patch) | |
| tree | 9e00f7821f4ce6f4aac2a841c68f2809ad0fd106 /cpp/src/qpid/broker/ConnectionHandler.cpp | |
| parent | 312d8e131e1951ebcd9b1d48bf318b112d4b7b33 (diff) | |
| download | qpid-python-477ef3c8435165fa70d6a19c195e4b14c4e6073f.tar.gz | |
- Added heartbeat generation to the client (actually echo back any
broker generated heartbeat)
- Broker now disconnects client if it receives no traffic in
2 heartbeat intervals (which is now the same as the client behvaiour)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@782651 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/ConnectionHandler.cpp')
| -rw-r--r-- | cpp/src/qpid/broker/ConnectionHandler.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/cpp/src/qpid/broker/ConnectionHandler.cpp b/cpp/src/qpid/broker/ConnectionHandler.cpp index 8b70836da0..d3e795ae06 100644 --- a/cpp/src/qpid/broker/ConnectionHandler.cpp +++ b/cpp/src/qpid/broker/ConnectionHandler.cpp @@ -8,9 +8,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -63,6 +63,9 @@ void ConnectionHandler::heartbeat() void ConnectionHandler::handle(framing::AMQFrame& frame) { + // Received frame on connection so delay timeout + handler->connection.restartTimeout(); + AMQMethodBody* method=frame.getBody()->getMethod(); Connection::ErrorListener* errorListener = handler->connection.getErrorListener(); try{ @@ -186,7 +189,7 @@ void ConnectionHandler::Handler::open(const string& /*virtualHost*/, { std::vector<Url> urls = connection.broker.getKnownBrokers(); framing::Array array(0x95); // str16 array - for (std::vector<Url>::iterator i = urls.begin(); i < urls.end(); ++i) + for (std::vector<Url>::iterator i = urls.begin(); i < urls.end(); ++i) array.add(boost::shared_ptr<Str16Value>(new Str16Value(i->str()))); proxy.openOk(array); @@ -197,7 +200,7 @@ void ConnectionHandler::Handler::open(const string& /*virtualHost*/, } } - + void ConnectionHandler::Handler::close(uint16_t replyCode, const string& replyText) { if (replyCode != 200) { @@ -209,11 +212,11 @@ void ConnectionHandler::Handler::close(uint16_t replyCode, const string& replyTe proxy.closeOk(); connection.getOutput().close(); -} - +} + void ConnectionHandler::Handler::closeOk(){ connection.getOutput().close(); -} +} void ConnectionHandler::Handler::heartbeat(){ // Do nothing - the purpose of heartbeats is just to make sure that there is some |
