Changeset 10509


Ignore:
Timestamp:
Apr 22, 2010, 2:04:43 AM (9 years ago)
Author:
charles
Message:

(trunk libT) #3162 "allow optional end-user configuration of TCP_CONGESTION" -- minor tweak removing a little bit of code duplication in r10508

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-io.c

    r10508 r10509  
    357357**/
    358358
     359static void
     360maybeSetCongestionAlgorithm( int socket, const char * algorithm )
     361{
     362    if( algorithm && *algorithm )
     363    {
     364        const int rc = tr_netSetCongestionControl( socket, algorithm );
     365
     366        if( rc < 0 )
     367            tr_ninf( "Net", "Can't set congestion control algorithm '%s': %s",
     368                     algorithm, tr_strerror( errno ));
     369    }
     370}
     371
    359372static tr_peerIo*
    360373tr_peerIoNew( tr_session       * session,
     
    377390    if( socket >= 0 ) {
    378391        tr_netSetTOS( socket, session->peerSocketTOS );
    379         if( session->peer_congestion_algorithm &&
    380             session->peer_congestion_algorithm[0] ) {
    381             int rc;
    382             rc = tr_netSetCongestionControl( socket,
    383                                              session->peer_congestion_algorithm );
    384             if(rc < 0) {
    385                 tr_ninf( "Net",
    386                          "Couldn't set congestion control algorithm: %s\n",
    387                          strerror(errno));
    388             }
    389         }
     392        maybeSetCongestionAlgorithm( socket, session->peer_congestion_algorithm );
    390393    }
    391394   
     
    659662    {
    660663        tr_netSetTOS( io->socket, session->peerSocketTOS );
    661         if( session->peer_congestion_algorithm &&
    662             session->peer_congestion_algorithm[0] ) {
    663             int rc;
    664             rc = tr_netSetCongestionControl( io->socket,
    665                                              session->peer_congestion_algorithm );
    666             if(rc < 0) {
    667                 tr_ninf( "Net",
    668                          "Couldn't set congestion control algorithm: %s\n",
    669                          strerror(errno));
    670             }
    671         }
    672 
     664        maybeSetCongestionAlgorithm( io->socket, session->peer_congestion_algorithm );
    673665        return 0;
    674666    }
Note: See TracChangeset for help on using the changeset viewer.