void
tr_fdTorrentClose (tr_session * session, int torrent_id)
{
- fileset_close_torrent (get_fileset (session), torrent_id);
+ assert (tr_sessionIsLocked (session));
+
+ fileset_close_torrent (get_fileset (session), torrent_id);
}
/* returns an fd on success, or a -1 on failure and sets errno */
tr_torrentVerify (tr_torrent * tor)
{
if (tr_isTorrent (tor))
- {
- tr_verifyRemove (tor);
- tr_runInEventThread (tor->session, verifyTorrent, tor);
- }
+ tr_runInEventThread (tor->session, verifyTorrent, tor);
}
void
static void
removeTorrent (void * vdata)
{
- struct remove_data * data = vdata;
+ struct remove_data * data = vdata;
+ tr_session * session = data->tor->session;
+ tr_sessionLock (session);
- if (data->deleteFlag)
- tr_torrentDeleteLocalData (data->tor, data->deleteFunc);
+ if (data->deleteFlag)
+ tr_torrentDeleteLocalData (data->tor, data->deleteFunc);
- tr_torrentClearCompletenessCallback (data->tor);
- closeTorrent (data->tor);
- tr_free (data);
+ tr_torrentClearCompletenessCallback (data->tor);
+ closeTorrent (data->tor);
+ tr_free (data);
+
+ tr_sessionUnlock (session);
}
void