mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 08:59:50 -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,
|
TransfersHandler::TransfersHandler(StateTokenServer *sts, RsFiles *files, RsPeers *peers,
|
||||||
RsNotify* notify):
|
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("*", this, &TransfersHandler::handleWildcard);
|
||||||
addResourceHandler("downloads", this, &TransfersHandler::handleDownloads);
|
addResourceHandler("downloads", this, &TransfersHandler::handleDownloads);
|
||||||
@ -27,9 +28,9 @@ TransfersHandler::~TransfersHandler()
|
|||||||
|
|
||||||
void TransfersHandler::notifyListChange(int list, int /* type */)
|
void TransfersHandler::notifyListChange(int list, int /* type */)
|
||||||
{
|
{
|
||||||
//RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
|
||||||
if(list == NOTIFY_LIST_TRANSFERLIST)
|
if(list == NOTIFY_LIST_TRANSFERLIST)
|
||||||
{
|
{
|
||||||
|
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||||
mStateTokenServer->discardToken(mStateToken);
|
mStateTokenServer->discardToken(mStateToken);
|
||||||
mStateToken = mStateTokenServer->getNewToken();
|
mStateToken = mStateTokenServer->getNewToken();
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ public:
|
|||||||
TransfersHandler(StateTokenServer* sts, RsFiles* files, RsPeers *peers, RsNotify* notify);
|
TransfersHandler(StateTokenServer* sts, RsFiles* files, RsPeers *peers, RsNotify* notify);
|
||||||
virtual ~TransfersHandler();
|
virtual ~TransfersHandler();
|
||||||
|
|
||||||
|
// from NotifyClient
|
||||||
|
// may be called from foreign thread
|
||||||
virtual void notifyListChange(int list, int type);
|
virtual void notifyListChange(int list, int type);
|
||||||
// from Tickable
|
// from Tickable
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
@ -30,6 +32,7 @@ private:
|
|||||||
RsPeers* mRsPeers;
|
RsPeers* mRsPeers;
|
||||||
RsNotify* mNotify;
|
RsNotify* mNotify;
|
||||||
|
|
||||||
|
RsMutex mMtx;
|
||||||
StateToken mStateToken;
|
StateToken mStateToken;
|
||||||
time_t mLastUpdateTS;
|
time_t mLastUpdateTS;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user