diff --git a/client.cpp b/client.cpp
index d9683cd..35fef94 100644
--- a/client.cpp
+++ b/client.cpp
@@ -277,9 +277,9 @@ bool Client::writeBufIntoFd()
std::string Client::repr()
{
- std::string s = formatString("[ClientID='%s', username='%s', fd=%d, keepalive=%ds, transport='%s', address='%s', cleanses=%d]",
+ std::string s = formatString("[ClientID='%s', username='%s', fd=%d, keepalive=%ds, transport='%s', address='%s', cleanses=%d, prot=%s]",
clientid.c_str(), username.c_str(), fd, keepalive, this->transportStr.c_str(), this->address.c_str(),
- cleanSession);
+ cleanSession, protocolVersionString(protocolVersion).c_str());
return s;
}
diff --git a/utils.cpp b/utils.cpp
index 1cf4428..8ce6334 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -651,3 +651,18 @@ const std::string websocketCloseCodeToString(uint16_t code)
return formatString("Websocket status code %d", code);
}
}
+
+const std::string protocolVersionString(ProtocolVersion p)
+{
+ switch (p)
+ {
+ case ProtocolVersion::None:
+ return "none";
+ case ProtocolVersion::Mqtt31:
+ return "3.1";
+ case ProtocolVersion::Mqtt311:
+ return "3.1.1";
+ default:
+ return "unknown";
+ }
+}
diff --git a/utils.h b/utils.h
index cef7f41..746c433 100644
--- a/utils.h
+++ b/utils.h
@@ -33,6 +33,7 @@ License along with FlashMQ. If not, see .
#include "cirbuf.h"
#include "bindaddr.h"
+#include "types.h"
template int check(int rc)
{
@@ -124,5 +125,7 @@ template void checkWritableDir(const std::string &path)
const std::string websocketCloseCodeToString(uint16_t code);
+const std::string protocolVersionString(ProtocolVersion p);
+
#endif // UTILS_H