From 9e8165449b8c1c81162ee5fb30a83753df3a4183 Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 4 Jul 2018 17:56:08 -0400 Subject: ... --- include/salticidae/msg.h | 17 ++++------------- include/salticidae/network.h | 4 +++- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/salticidae/msg.h b/include/salticidae/msg.h index 594ac07..874f85f 100644 --- a/include/salticidae/msg.h +++ b/include/salticidae/msg.h @@ -153,16 +153,6 @@ class MsgBase { << "length=" << get_hex(length) << " " << "checksum=" << get_hex(checksum) << " " << "payload=" << get_hex(payload) << ">"; - - //std::string opcode_hex = get_hex(opcode); - //char *buff = new char[128 + opcode_hex.size()]; - //size_t ret = sprintf(buff, - // ""; - //delete [] buff; - //return std::move(res); return std::string(s); } @@ -245,9 +235,10 @@ template const size_t MsgBase::header_size = - sizeof(MsgBase) - - sizeof(MsgBase::payload) - - sizeof(MsgBase::no_payload); + sizeof(MsgBase::magic) + + sizeof(MsgBase::opcode) + + sizeof(MsgBase::length) + + sizeof(MsgBase::checksum); template::Conn::on_read() { } auto it = mn->handler_map.find(msg.get_opcode()); if (it == mn->handler_map.end()) - SALTICIDAE_LOG_WARN("unknown command: %s", get_hex(msg.get_opcode())); + SALTICIDAE_LOG_WARN("unknown opcode: %s", + get_hex(msg.get_opcode()).c_str()); else /* call the handler */ { SALTICIDAE_LOG_DEBUG("got message %s from %s", @@ -497,6 +498,7 @@ void PeerNetwork::reset_conn_timeout(conn_t conn) { assert(conn->ev_timeout); conn->ev_timeout.del(); conn->ev_timeout.add_with_timeout(conn_timeout); + SALTICIDAE_LOG_INFO("reset timeout %.2f", conn_timeout); } template -- cgit v1.2.3