From b8b3d7515c6f16dbdd3966d5d94079d746e565b7 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Mon, 22 Feb 2021 09:04:33 +0100 Subject: [PATCH] add missing mutex locks around free_pend calls in pqistreamer.cc --- libretroshare/src/pqi/pqistreamer.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index f5d61ab9f..db38bfde2 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -304,17 +304,13 @@ int pqistreamer::tick_bio() int pqistreamer::tick_recv(uint32_t timeout) { -// Apart from a few exceptions that are atomic (mLastIncomingTs, mIncomingSize), only this pqi thread reads/writes mIncoming queue and related counters. -// The lock of pqistreamer mutex is thus not needed here. -// The mutex lock is still needed before calling locked_addTrafficClue because this method is also used by the thread pushing packets in mOutPkts. -// Locks around rates are provided internally. - if (mBio->moretoread(timeout)) { handleincoming(); } if(!(mBio->isactive())) { + RsStackMutex stack(mStreamerMtx); free_pend(); } return 1; @@ -325,6 +321,7 @@ int pqistreamer::tick_send(uint32_t timeout) /* short circuit everything if bio isn't active */ if (!(mBio->isactive())) { + RsStackMutex stack(mStreamerMtx); free_pend(); return 0; } @@ -720,6 +717,7 @@ int pqistreamer::handleincoming() if(!(mBio->isactive())) { + RsStackMutex stack(mStreamerMtx); mReading_state = reading_state_initial ; free_pend(); return 0;