mirror of
https://github.com/transmission/transmission
synced 2025-01-02 13:05:08 +00:00
#5891: Move UDP shutdown timer setup to sessionCloseImplStart
This commit is contained in:
parent
d3f5b5d5ab
commit
7d30ad3ff6
1 changed files with 30 additions and 22 deletions
|
@ -1780,6 +1780,11 @@ compareTorrentByCur (const void * va, const void * vb)
|
||||||
|
|
||||||
static void closeBlocklists (tr_session *);
|
static void closeBlocklists (tr_session *);
|
||||||
|
|
||||||
|
static void
|
||||||
|
sessionCloseImplWaitForIdleUdp (evutil_socket_t foo UNUSED,
|
||||||
|
short bar UNUSED,
|
||||||
|
void * vsession);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sessionCloseImplStart (tr_session * session)
|
sessionCloseImplStart (tr_session * session)
|
||||||
{
|
{
|
||||||
|
@ -1826,26 +1831,15 @@ sessionCloseImplStart (tr_session * session)
|
||||||
|
|
||||||
tr_cacheFree (session->cache);
|
tr_cacheFree (session->cache);
|
||||||
session->cache = NULL;
|
session->cache = NULL;
|
||||||
|
|
||||||
|
/* saveTimer is not used at this point, reusing for UDP shutdown wait */
|
||||||
|
assert (session->saveTimer == NULL);
|
||||||
|
session->saveTimer = evtimer_new (session->event_base, sessionCloseImplWaitForIdleUdp, session);
|
||||||
|
tr_timerAdd (session->saveTimer, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sessionCloseImplFinish (tr_session * session)
|
sessionCloseImplFinish (tr_session * session);
|
||||||
{
|
|
||||||
/* we had to wait until UDP trackers were closed before closing these: */
|
|
||||||
evdns_base_free (session->evdns_base, 0);
|
|
||||||
session->evdns_base = NULL;
|
|
||||||
tr_tracker_udp_close (session);
|
|
||||||
tr_udpUninit (session);
|
|
||||||
|
|
||||||
tr_statsClose (session);
|
|
||||||
tr_peerMgrFree (session->peerMgr);
|
|
||||||
|
|
||||||
closeBlocklists (session);
|
|
||||||
|
|
||||||
tr_fdClose (session);
|
|
||||||
|
|
||||||
session->isClosed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sessionCloseImplWaitForIdleUdp (evutil_socket_t foo UNUSED,
|
sessionCloseImplWaitForIdleUdp (evutil_socket_t foo UNUSED,
|
||||||
|
@ -1868,6 +1862,25 @@ sessionCloseImplWaitForIdleUdp (evutil_socket_t foo UNUSED,
|
||||||
sessionCloseImplFinish (session);
|
sessionCloseImplFinish (session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sessionCloseImplFinish (tr_session * session)
|
||||||
|
{
|
||||||
|
/* we had to wait until UDP trackers were closed before closing these: */
|
||||||
|
evdns_base_free (session->evdns_base, 0);
|
||||||
|
session->evdns_base = NULL;
|
||||||
|
tr_tracker_udp_close (session);
|
||||||
|
tr_udpUninit (session);
|
||||||
|
|
||||||
|
tr_statsClose (session);
|
||||||
|
tr_peerMgrFree (session->peerMgr);
|
||||||
|
|
||||||
|
closeBlocklists (session);
|
||||||
|
|
||||||
|
tr_fdClose (session);
|
||||||
|
|
||||||
|
session->isClosed = true;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sessionCloseImpl (void * vsession)
|
sessionCloseImpl (void * vsession)
|
||||||
{
|
{
|
||||||
|
@ -1876,11 +1889,6 @@ sessionCloseImpl (void * vsession)
|
||||||
assert (tr_isSession (session));
|
assert (tr_isSession (session));
|
||||||
|
|
||||||
sessionCloseImplStart (session);
|
sessionCloseImplStart (session);
|
||||||
|
|
||||||
/* saveTimer is not used at this point, reusing for UDP shutdown wait */
|
|
||||||
assert (session->saveTimer == NULL);
|
|
||||||
session->saveTimer = evtimer_new (session->event_base, sessionCloseImplWaitForIdleUdp, session);
|
|
||||||
tr_timerAdd (session->saveTimer, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in a new issue