diff options
| author | Nils Maier <maierman@web.de> | 2014-12-14 10:31:37 +0100 |
|---|---|---|
| committer | Nils Maier <maierman@web.de> | 2014-12-14 10:34:09 +0100 |
| commit | 48bcb47a30c1a3fc41bfba23745a3b864fe5691a (patch) | |
| tree | 15d298c2d9c97bf47f880dad5d465fb8c8ae4ff8 /src/SocketCore.cc | |
| parent | 3c8704178a94a9ae3abde238aa4c369efd5f01a1 (diff) | |
Refine messages to include peer info
Diffstat (limited to 'src/SocketCore.cc')
| -rw-r--r-- | src/SocketCore.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/SocketCore.cc b/src/SocketCore.cc index 035bf958..a4c0aafc 100644 --- a/src/SocketCore.cc +++ b/src/SocketCore.cc @@ -45,6 +45,7 @@ #include <cerrno> #include <cstring> +#include <sstream> #include "message.h" #include "DlRetryEx.h" @@ -885,12 +886,24 @@ bool SocketCore::tlsHandshake(TLSContext* tlsctx, const std::string& hostname) break; } + std::stringstream ss; + if (!hostname.empty()) { + ss << hostname << " ("; + } + std::pair<std::string, uint16_t> peer; + getPeerInfo(peer); + ss << peer.first << ":" << peer.second; + if (!hostname.empty()) { + ss << ")"; + } + auto peerInfo = ss.str(); + switch(ver) { case TLS_PROTO_NONE: - A2_LOG_WARN(MSG_WARN_UNKNOWN_TLS_CONNECTION); + A2_LOG_WARN(fmt(MSG_WARN_UNKNOWN_TLS_CONNECTION, peerInfo.c_str())); break; case TLS_PROTO_SSL3: - A2_LOG_WARN(fmt(MSG_WARN_OLD_TLS_CONNECTION, "SSLv3")); + A2_LOG_WARN(fmt(MSG_WARN_OLD_TLS_CONNECTION, "SSLv3", peerInfo.c_str())); break; default: break; |
