mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
Added in Libresapi: Missing mutex locking in TransfersHandler
This commit is contained in:
parent
6a61e0a781
commit
9bb6adc036
@ -8,7 +8,8 @@ namespace resource_api
|
||||
|
||||
TransfersHandler::TransfersHandler(StateTokenServer *sts, RsFiles *files, RsPeers *peers,
|
||||
RsNotify* notify):
|
||||
mStateTokenServer(sts), mFiles(files), mRsPeers(peers), mLastUpdateTS(0), mNotify(notify)
|
||||
mStateTokenServer(sts), mFiles(files), mRsPeers(peers), mLastUpdateTS(0), mNotify(notify),
|
||||
mMtx("TransfersHandler")
|
||||
{
|
||||
addResourceHandler("*", this, &TransfersHandler::handleWildcard);
|
||||
addResourceHandler("downloads", this, &TransfersHandler::handleDownloads);
|
||||
@ -27,9 +28,9 @@ TransfersHandler::~TransfersHandler()
|
||||
|
||||
void TransfersHandler::notifyListChange(int list, int /* type */)
|
||||
{
|
||||
//RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
if(list == NOTIFY_LIST_TRANSFERLIST)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->discardToken(mStateToken);
|
||||
mStateToken = mStateTokenServer->getNewToken();
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ public:
|
||||
TransfersHandler(StateTokenServer* sts, RsFiles* files, RsPeers *peers, RsNotify* notify);
|
||||
virtual ~TransfersHandler();
|
||||
|
||||
// from NotifyClient
|
||||
// may be called from foreign thread
|
||||
virtual void notifyListChange(int list, int type);
|
||||
// from Tickable
|
||||
virtual void tick();
|
||||
@ -30,6 +32,7 @@ private:
|
||||
RsPeers* mRsPeers;
|
||||
RsNotify* mNotify;
|
||||
|
||||
RsMutex mMtx;
|
||||
StateToken mStateToken;
|
||||
time_t mLastUpdateTS;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user