diff options
author | Gordon Sim <gsim@apache.org> | 2007-08-13 09:41:45 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2007-08-13 09:41:45 +0000 |
commit | f458ec7b59e6c03f59e8b33474bbe70f9a9873dc (patch) | |
tree | 5b750882fbaf54fe42ded428c76967f70ed55b3f /cpp/lib/client | |
parent | 2553b54071b2ab89faaf503e3c3c8449fed07070 (diff) | |
download | qpid-python-f458ec7b59e6c03f59e8b33474bbe70f9a9873dc.tar.gz |
Fixes for QPID-544 and QPID-548
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@565284 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/client')
-rw-r--r-- | cpp/lib/client/Connection.cpp | 9 | ||||
-rw-r--r-- | cpp/lib/client/Connection.h | 3 | ||||
-rw-r--r-- | cpp/lib/client/Connector.cpp | 5 | ||||
-rw-r--r-- | cpp/lib/client/Connector.h | 2 |
4 files changed, 15 insertions, 4 deletions
diff --git a/cpp/lib/client/Connection.cpp b/cpp/lib/client/Connection.cpp index f7897aa4df..c00b58a4a9 100644 --- a/cpp/lib/client/Connection.cpp +++ b/cpp/lib/client/Connection.cpp @@ -35,7 +35,8 @@ Connection::Connection( bool _debug, u_int32_t _max_frame_size, qpid::framing:: channelIdCounter(0), max_frame_size(_max_frame_size), closed(true), - version(_version->getMajor(),_version->getMinor()) + version(_version->getMajor(),_version->getMinor()), + tcpNoDelay(false) { connector = new Connector(version, debug, _max_frame_size); } @@ -44,6 +45,10 @@ Connection::~Connection(){ delete connector; } +void Connection::setTcpNoDelay(bool on) { + tcpNoDelay = on; +} + void Connection::open(const std::string& _host, int _port, const std::string& uid, const std::string& pwd, const std::string& virtualhost){ host = _host; port = _port; @@ -51,7 +56,7 @@ void Connection::open(const std::string& _host, int _port, const std::string& ui connector->setTimeoutHandler(this); connector->setShutdownHandler(this); out = connector->getOutputHandler(); - connector->connect(host, port); + connector->connect(host, port, tcpNoDelay); ProtocolInitiation* header = new ProtocolInitiation(version); responses.expect(); diff --git a/cpp/lib/client/Connection.h b/cpp/lib/client/Connection.h index bbf8c03b0b..2222250188 100644 --- a/cpp/lib/client/Connection.h +++ b/cpp/lib/client/Connection.h @@ -80,6 +80,7 @@ namespace client { ResponseHandler responses; volatile bool closed; qpid::framing::ProtocolVersion version; + bool tcpNoDelay; void channelException(Channel* channel, qpid::framing::AMQMethodBody* body, QpidError& e); void error(int code, const std::string& msg, int classid = 0, int methodid = 0); @@ -109,6 +110,8 @@ namespace client { qpid::framing::ProtocolVersion* _version = &(qpid::framing::highestProtocolVersion)); ~Connection(); + void setTcpNoDelay(bool on); + /** * Opens a connection to a broker. * diff --git a/cpp/lib/client/Connector.cpp b/cpp/lib/client/Connector.cpp index c57b3d6dc4..a99360b840 100644 --- a/cpp/lib/client/Connector.cpp +++ b/cpp/lib/client/Connector.cpp @@ -44,8 +44,11 @@ Connector::Connector(const qpid::framing::ProtocolVersion& pVersion, bool _debug Connector::~Connector(){ } -void Connector::connect(const std::string& host, int port){ +void Connector::connect(const std::string& host, int port, bool tcpNoDelay){ socket = Socket::createTcp(); + if (tcpNoDelay) { + socket.setTcpNoDelay(true); + } socket.connect(host, port); closed = false; receiver = Thread(this); diff --git a/cpp/lib/client/Connector.h b/cpp/lib/client/Connector.h index eccb931e6c..44112369dc 100644 --- a/cpp/lib/client/Connector.h +++ b/cpp/lib/client/Connector.h @@ -78,7 +78,7 @@ namespace client { public: Connector(const qpid::framing::ProtocolVersion& pVersion, bool debug = false, u_int32_t buffer_size = 1024); virtual ~Connector(); - virtual void connect(const std::string& host, int port); + virtual void connect(const std::string& host, int port, bool tcpNoDelay=false); virtual void init(qpid::framing::ProtocolInitiation* header); virtual void close(); virtual void setInputHandler(qpid::framing::InputHandler* handler); |