You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2019/05/14 17:58:01 UTC

[qpid-cpp] branch master updated: QPID-8313: truncate connection error message if necessary to fit in str8

This is an automated email from the ASF dual-hosted git repository.

gsim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 680cc0f  QPID-8313: truncate connection error message if necessary to fit in str8
680cc0f is described below

commit 680cc0ff48a6b1ed5e7271ac1f9d2fe62766bc1b
Author: Gordon Sim <gs...@redhat.com>
AuthorDate: Tue May 14 18:57:44 2019 +0100

    QPID-8313: truncate connection error message if necessary to fit in str8
---
 src/qpid/broker/amqp_0_10/Connection.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/qpid/broker/amqp_0_10/Connection.cpp b/src/qpid/broker/amqp_0_10/Connection.cpp
index 7d335c9..03d283b 100644
--- a/src/qpid/broker/amqp_0_10/Connection.cpp
+++ b/src/qpid/broker/amqp_0_10/Connection.cpp
@@ -333,6 +333,15 @@ void Connection::raiseConnectEvent() {
         << " rhost:" << mgmtId );
 }
 
+std::string truncate(const std::string& in, size_t length)
+{
+    if (in.size() < length) {
+        return in;
+    } else {
+        return in.substr(0, length);
+    }
+}
+
 void Connection::close(connection::CloseCode code, const string& text)
 {
     QPID_LOG_IF(error, code != connection::CLOSE_CODE_NORMAL, "Connection " << mgmtId << " closed by error: " << text << "(" << code << ")");
@@ -343,7 +352,7 @@ void Connection::close(connection::CloseCode code, const string& text)
     if (linkHeartbeatTimer) {
         linkHeartbeatTimer->cancel();
     }
-    adapter.close(code, text);
+    adapter.close(code, truncate(text, 128));
     //make sure we delete dangling pointers from outputTasks before deleting sessions
     outputTasks.removeAll();
     channels.clear();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org