Changeset 12182


Ignore:
Timestamp:
Mar 17, 2011, 12:45:29 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) move tr_lpdAnnounceMore() out of the announcer module

We can stop local peer discovery immediately during shutdown, but need to leave the announcer running for the event=stopped messages. So it doesn't make sense to keep them on the same periodic timer.

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r12181 r12182  
    2929#include "ptrarray.h"
    3030#include "session.h"
    31 #include "tr-lpd.h"
    3231#include "torrent.h"
    3332#include "utils.h"
     
    6362
    6463    UPKEEP_INTERVAL_SECS = 1,
    65 
    66     /* this is an upper limit for the frequency of LDS announces */
    67     LPD_HOUSEKEEPING_INTERVAL_SECS = 5,
    6864
    6965    /* this is how often to call the UDP tracker upkeep */
     
    15061502    announceMore( announcer );
    15071503
    1508     /* LPD upkeep */
    1509     if( announcer->lpdUpkeepAt <= now ) {
    1510         const int seconds = LPD_HOUSEKEEPING_INTERVAL_SECS;
    1511         announcer->lpdUpkeepAt = now + jitterize( seconds );
    1512         tr_lpdAnnounceMore( now, seconds );
    1513     }
    1514 
    15151504    /* TAU upkeep */
    15161505    if( announcer->tauUpkeepAt <= now ) {
  • trunk/libtransmission/session.c

    r12181 r12182  
    610610    tr_torrent * tor = NULL;
    611611    tr_session * session = vsession;
     612    const time_t now = time( NULL );
    612613
    613614    assert( tr_isSession( session ) );
     
    618619    **/
    619620
    620     tr_timeUpdate( time( NULL ) );
     621    tr_timeUpdate( now );
    621622
    622623    tr_dhtUpkeep( session );
     624
     625    /* lpd upkeep */
     626    if( session->lpdUpkeepAt <= now ) {
     627        const int LPD_UPKEEP_INTERVAL_SECS = 5;
     628        session->lpdUpkeepAt = now + LPD_UPKEEP_INTERVAL_SECS;
     629        tr_lpdAnnounceMore( now, LPD_UPKEEP_INTERVAL_SECS );
     630    }
    623631
    624632    if( session->turtle.isClockEnabled )
  • trunk/libtransmission/session.h

    r12141 r12182  
    143143    struct event                 *udp6_event;
    144144
     145    time_t                       lpdUpkeepAt;
     146
    145147    /* The open port on the local machine for incoming peer requests */
    146148    tr_port                      private_peer_port;
Note: See TracChangeset for help on using the changeset viewer.