From 3554e48c7edc75ab3dd072b4f22fff20e3488d1d Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 3 Apr 2016 11:38:53 -0400 Subject: [PATCH] output packet error with some details (inspired by Phenom-PR289) --- libretroshare/src/pqi/pqistreamer.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index 7a4b1dbdd..a8f6820c7 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -29,6 +29,7 @@ #include #include "util/rsdebug.h" #include "util/rsstring.h" +#include "util/rsprint.h" #include "pqi/pqistreamer.h" #include "rsserver/p3face.h" @@ -837,6 +838,12 @@ continue_packet: #ifdef DEBUG_PQISTREAMER pqioutput(PQL_ALERT, pqistreamerzone, "Failed to handle Packet!"); #endif + std::cerr << "Incoming Packet could not be deserialised:" << std::endl; + std::cerr << " Incoming peer id: " << PeerId() << std::endl; + if(pktlen >= 8) + std::cerr << " Packet header : " << RsUtil::BinToHex((unsigned char*)block,8) << std::endl; + if(pktlen > 8) + std::cerr << " Packet data : " << RsUtil::BinToHex((unsigned char*)block+8,std::min(50u,pktlen-8)) << ((pktlen>58)?"...":"") << std::endl; } mReading_state = reading_state_initial ; // restart at state 1.