From 192cbe1edae177ab7f80441dadd211ab25bd6df4 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sat, 5 Nov 2016 14:57:39 +0100 Subject: [PATCH 1/2] Create two #define in pqistreamer.cc to easily disable packet slicing and/or grouping --- libretroshare/src/pqi/pqistreamer.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index a96c93148..f5ef365af 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -64,6 +64,10 @@ static const int PQISTREAM_PACKET_SLICING_PROBE_DELAY = 60; // send every 6 static uint8_t PACKET_SLICING_PROBE_BYTES[8] = { 0x02, 0xaa, 0xbb, 0xcc, 0x00, 0x00, 0x00, 0x08 } ; +/* Change to true to disable packet slicing and/or packet grouping, if needed */ +#define DISABLE_PACKET_SLICING false +#define DISABLE_PACKET_GROUPING false + /* This removes the print statements (which hammer pqidebug) */ /*** #define RSITEM_DEBUG 1 @@ -629,7 +633,7 @@ int pqistreamer::handleoutgoing_locked() ++k ; } } - while(mPkt_wpending_size < (uint32_t)maxbytes && mPkt_wpending_size < PQISTREAM_OPTIMAL_PACKET_SIZE ) ; + while(mPkt_wpending_size < (uint32_t)maxbytes && mPkt_wpending_size < PQISTREAM_OPTIMAL_PACKET_SIZE && !DISABLE_PACKET_GROUPING) ; #ifdef DEBUG_PQISTREAMER if(k > 1) @@ -787,7 +791,7 @@ start_packet_read: if(!memcmp(block,PACKET_SLICING_PROBE_BYTES,8)) { - mAcceptsPacketSlicing = true ; + mAcceptsPacketSlicing = (true && !DISABLE_PACKET_SLICING); #ifdef DEBUG_PACKET_SLICING std::cerr << "(II) Enabling packet slicing!" << std::endl; #endif @@ -815,7 +819,7 @@ continue_packet: #endif is_partial_packet = true ; - mAcceptsPacketSlicing = true ; // this is needed + mAcceptsPacketSlicing = (true && !DISABLE_PACKET_SLICING); // this is needed } else extralen = getRsItemSize(block) - blen; // old style packet type From 78d6735b52f7ec82aaa0e3b7bec8ed2e728e0707 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sat, 5 Nov 2016 19:58:06 +0100 Subject: [PATCH 2/2] Create 2 #define in pqistreamer to easily disable packet slicing/grouping --- libretroshare/src/pqi/pqistreamer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index f5ef365af..aa52ec02c 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -791,7 +791,7 @@ start_packet_read: if(!memcmp(block,PACKET_SLICING_PROBE_BYTES,8)) { - mAcceptsPacketSlicing = (true && !DISABLE_PACKET_SLICING); + mAcceptsPacketSlicing = !DISABLE_PACKET_SLICING; #ifdef DEBUG_PACKET_SLICING std::cerr << "(II) Enabling packet slicing!" << std::endl; #endif @@ -819,7 +819,7 @@ continue_packet: #endif is_partial_packet = true ; - mAcceptsPacketSlicing = (true && !DISABLE_PACKET_SLICING); // this is needed + mAcceptsPacketSlicing = !DISABLE_PACKET_SLICING; // this is needed } else extralen = getRsItemSize(block) - blen; // old style packet type