Changeset 6043


Ignore:
Timestamp:
Jun 5, 2008, 2:07:17 AM (14 years ago)
Author:
charles
Message:

(libT RPC server): poll more frequently for new commands after we've received the first one.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpc-server.c

    r6036 r6043  
    2828
    2929#define BUSY_INTERVAL_MSEC 30
    30 #define IDLE_INTERVAL_MSEC 1000
     30#define IDLE_INTERVAL_MSEC 100
     31#define UNUSED_INTERVAL_MSEC 1000
    3132
    3233struct tr_rpc_server
    3334{
    3435    int port;
     36    time_t lastRequestTime;
    3537    struct shttpd_ctx * ctx;
    3638    tr_handle * session;
     
    9799    struct timeval tv;
    98100    tr_rpc_server * server = vserver;
     101    const time_t now = time( NULL );
    99102
    100103    assert( server );
     
    103106
    104107    /* set a timer for the next pulse */
    105     if( EVBUFFER_LENGTH( server->in ) || EVBUFFER_LENGTH( server->out ) )
     108    if( EVBUFFER_LENGTH( server->in ) || EVBUFFER_LENGTH( server->out ) ) {
    106109        interval = BUSY_INTERVAL_MSEC;
    107     else
     110        server->lastRequestTime = now;
     111    } else if( now - server->lastRequestTime < 300 ) {
    108112        interval = IDLE_INTERVAL_MSEC;
     113    } else {
     114        interval = UNUSED_INTERVAL_MSEC;
     115    }
    109116    tv = tr_timevalMsec( interval );
    110117    evtimer_add( &server->timer, &tv );
     
    117124    {
    118125        char ports[128];
    119         struct timeval tv = tr_timevalMsec( IDLE_INTERVAL_MSEC );
     126        struct timeval tv = tr_timevalMsec( UNUSED_INTERVAL_MSEC );
    120127
    121128        server->ctx = shttpd_init( );
  • trunk/libtransmission/rpc-server.h

    r6031 r6043  
    3737                              char                  ** allocme_errmsg );
    3838
     39int         tr_rpcTestACL   ( const tr_rpc_server    * server,
     40                              const char             * acl,
     41                              char                  ** allocme_errmsg );
     42
    3943int         tr_rpcSetACL    ( tr_rpc_server          * server,
    4044                              const char             * acl,
Note: See TracChangeset for help on using the changeset viewer.