diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/salticidae/msg.h | 17 | ||||
-rw-r--r-- | include/salticidae/network.h | 4 |
2 files changed, 7 insertions, 14 deletions
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, - // "<magic=%08x opcode=%s length=%08x checksum=%08x payload=", - // magic, opcode_hex.c_str(), length, checksum); - //buff[ret] = 0; - //std::string res = std::string(buff) + bin2hexstr(payload.data(), length) + ">"; - //delete [] buff; - //return std::move(res); return std::string(s); } @@ -245,9 +235,10 @@ template<typename OpcodeType, OpcodeType _, OpcodeType __> const size_t MsgBase<OpcodeType, _, __>::header_size = - sizeof(MsgBase<OpcodeType, _, __>) - - sizeof(MsgBase<OpcodeType, _, __>::payload) - - sizeof(MsgBase<OpcodeType, _, __>::no_payload); + sizeof(MsgBase<OpcodeType, _, __>::magic) + + sizeof(MsgBase<OpcodeType, _, __>::opcode) + + sizeof(MsgBase<OpcodeType, _, __>::length) + + sizeof(MsgBase<OpcodeType, _, __>::checksum); template<typename OpcodeType, OpcodeType PING, diff --git a/include/salticidae/network.h b/include/salticidae/network.h index 3b82927..1b20ce1 100644 --- a/include/salticidae/network.h +++ b/include/salticidae/network.h @@ -263,7 +263,8 @@ void MsgNetwork<MsgType>::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<MsgType>::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<typename MsgType> |