Changeset 14649


Ignore:
Timestamp:
Dec 31, 2015, 2:24:15 PM (6 years ago)
Author:
mikedld
Message:

#5891: Move UDP shutdown timer setup to sessionCloseImplStart

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/session.c

    r14648 r14649  
    17821782
    17831783static void
     1784sessionCloseImplWaitForIdleUdp (evutil_socket_t   foo UNUSED,
     1785                                short             bar UNUSED,
     1786                                void            * vsession);
     1787
     1788static void
    17841789sessionCloseImplStart (tr_session * session)
    17851790{
     
    18271832  tr_cacheFree (session->cache);
    18281833  session->cache = NULL;
     1834
     1835  /* saveTimer is not used at this point, reusing for UDP shutdown wait */
     1836  assert (session->saveTimer == NULL);
     1837  session->saveTimer = evtimer_new (session->event_base, sessionCloseImplWaitForIdleUdp, session);
     1838  tr_timerAdd (session->saveTimer, 0, 0);
     1839}
     1840
     1841static void
     1842sessionCloseImplFinish (tr_session * session);
     1843
     1844static void
     1845sessionCloseImplWaitForIdleUdp (evutil_socket_t   foo UNUSED,
     1846                                short             bar UNUSED,
     1847                                void            * vsession)
     1848{
     1849  tr_session * session = vsession;
     1850
     1851  assert (tr_isSession (session));
     1852
     1853  /* gotta keep udp running long enough to send out all
     1854     the &event=stopped UDP tracker messages */
     1855  if (!tr_tracker_udp_is_idle (session))
     1856    {
     1857      tr_tracker_udp_upkeep (session);
     1858      tr_timerAdd (session->saveTimer, 0, 100000);
     1859      return;
     1860    }
     1861
     1862  sessionCloseImplFinish (session);
    18291863}
    18301864
     
    18491883
    18501884static void
    1851 sessionCloseImplWaitForIdleUdp (evutil_socket_t   foo UNUSED,
    1852                                 short             bar UNUSED,
    1853                                 void            * vsession)
     1885sessionCloseImpl (void * vsession)
    18541886{
    18551887  tr_session * session = vsession;
     
    18571889  assert (tr_isSession (session));
    18581890
    1859   /* gotta keep udp running long enough to send out all
    1860      the &event=stopped UDP tracker messages */
    1861   if (!tr_tracker_udp_is_idle (session))
    1862     {
    1863       tr_tracker_udp_upkeep (session);
    1864       tr_timerAdd (session->saveTimer, 0, 100000);
    1865       return;
    1866     }
    1867 
    1868   sessionCloseImplFinish (session);
    1869 }
    1870 
    1871 static void
    1872 sessionCloseImpl (void * vsession)
    1873 {
    1874   tr_session * session = vsession;
    1875 
    1876   assert (tr_isSession (session));
    1877 
    18781891  sessionCloseImplStart (session);
    1879 
    1880   /* saveTimer is not used at this point, reusing for UDP shutdown wait */
    1881   assert (session->saveTimer == NULL);
    1882   session->saveTimer = evtimer_new (session->event_base, sessionCloseImplWaitForIdleUdp, session);
    1883   tr_timerAdd (session->saveTimer, 0, 0);
    18841892}
    18851893
Note: See TracChangeset for help on using the changeset viewer.