static xdr::msg_ptr duplicateMessage(xdr::msg_ptr const& msg) { xdr::msg_ptr msg2 = xdr::message_t::alloc(msg->size()); memcpy(msg2->raw_data(), msg->raw_data(), msg->raw_size()); return std::move(msg2); }
void Peer::recvMessage(xdr::msg_ptr const& msg) { LoadManager::PeerContext loadCtx(mApp, mPeerID); mLastRead = mApp.getClock().now(); mMessageRead.Mark(); mByteRead.Mark(msg->raw_size()); CLOG(TRACE, "Overlay") << "received xdr::msg_ptr"; try { AuthenticatedMessage am; xdr::xdr_from_msg(msg, am); recvMessage(am); } catch (xdr::xdr_runtime_error& e) { CLOG(ERROR, "Overlay") << "received corrupt xdr::msg_ptr " << e.what(); mDropInRecvMessageDecodeMeter.Mark(); drop(); return; } }