Log peer address who formed bad message

This commit is contained in:
Benau
2018-09-16 19:48:27 +08:00
parent 8cb5e43bad
commit f1057726ad

View File

@@ -20,6 +20,7 @@
#include "network/event.hpp"
#include "network/protocol.hpp"
#include "network/stk_peer.hpp"
#include "utils/log.hpp"
#include "utils/profiler.hpp"
#include "utils/time.hpp"
@@ -440,8 +441,9 @@ void ProtocolManager::update(int ticks)
}
catch (std::exception& e)
{
Log::error("ProtocolManager", "Synchronous event error: %s",
e.what());
const std::string& name = (*i)->getPeer()->getAddress().toString();
Log::error("ProtocolManager",
"Synchronous event error from %s: %s", name.c_str(), e.what());
Log::error("ProtocolManager", (*i)->data().getLogMessage().c_str());
}
m_sync_events_to_process.lock();
@@ -496,8 +498,9 @@ void ProtocolManager::asynchronousUpdate()
}
catch (std::exception& e)
{
Log::error("ProtocolManager", "Asynchronous event error: %s",
e.what());
const std::string& name = (*i)->getPeer()->getAddress().toString();
Log::error("ProtocolManager", "Asynchronous event "
"error from %s: %s", name.c_str(), e.what());
Log::error("ProtocolManager",
(*i)->data().getLogMessage().c_str());
}