Changeset 10508
- Timestamp:
- Apr 22, 2010, 1:49:16 AM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/net.c
r10498 r10508 36 36 #include <WS2tcpip.h> 37 37 #else 38 #include <sys/socket.h> 39 #include <netinet/in.h> 40 #include <netinet/tcp.h> 38 41 #include <arpa/inet.h> /* inet_addr */ 39 42 #include <netdb.h> … … 208 211 #else 209 212 return 0; 213 #endif 214 } 215 216 int 217 tr_netSetCongestionControl( int s, const char *algorithm ) 218 { 219 #ifdef TCP_CONGESTION 220 return setsockopt( s, IPPROTO_TCP, TCP_CONGESTION, 221 algorithm, strlen(algorithm) + 1 ); 222 #else 223 errno = ENOSYS; 224 return -1; 210 225 #endif 211 226 } -
trunk/libtransmission/net.h
r10018 r10508 116 116 int tos ); 117 117 118 int tr_netSetCongestionControl( int s, const char *algorithm ); 119 118 120 void tr_netClose( tr_session * session, int s ); 119 121 -
trunk/libtransmission/peer-io.c
r10300 r10508 375 375 assert( tr_amInEventThread( session ) ); 376 376 377 if( socket >= 0 ) 377 if( socket >= 0 ) { 378 378 tr_netSetTOS( socket, session->peerSocketTOS ); 379 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 } 390 } 391 380 392 io = tr_new0( tr_peerIo, 1 ); 381 393 io->magicNumber = MAGIC_NUMBER; … … 647 659 { 648 660 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 649 673 return 0; 650 674 } -
trunk/libtransmission/session.c
r10485 r10508 323 323 tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_PORT_RANDOM_HIGH, s->randomPortHigh ); 324 324 tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_SOCKET_TOS, s->peerSocketTOS ); 325 if(s->peer_congestion_algorithm && s->peer_congestion_algorithm[0]) 326 tr_bencDictAddStr ( d, TR_PREFS_KEY_PEER_CONGESTION_ALGORITHM, s->peer_congestion_algorithm ); 325 327 tr_bencDictAddBool( d, TR_PREFS_KEY_PEX_ENABLED, s->isPexEnabled ); 326 328 tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) ); … … 669 671 if( tr_bencDictFindInt( settings, TR_PREFS_KEY_PEER_SOCKET_TOS, &i ) ) 670 672 session->peerSocketTOS = i; 673 if( tr_bencDictFindStr( settings, TR_PREFS_KEY_PEER_CONGESTION_ALGORITHM, &str ) ) 674 session->peer_congestion_algorithm = tr_strdup(str); 671 675 if( tr_bencDictFindBool( settings, TR_PREFS_KEY_BLOCKLIST_ENABLED, &boolVal ) ) 672 676 tr_blocklistSetEnabled( session, boolVal ); … … 1657 1661 tr_free( session->proxyUsername ); 1658 1662 tr_free( session->proxyPassword ); 1663 tr_free( session->peer_congestion_algorithm ); 1659 1664 tr_free( session ); 1660 1665 } -
trunk/libtransmission/session.h
r10391 r10508 125 125 int proxyPort; 126 126 int peerSocketTOS; 127 char * peer_congestion_algorithm; 127 128 128 129 int torrentCount; -
trunk/libtransmission/transmission.h
r10477 r10508 179 179 #define TR_PREFS_KEY_PEER_PORT_RANDOM_HIGH "peer-port-random-high" 180 180 #define TR_PREFS_KEY_PEER_SOCKET_TOS "peer-socket-tos" 181 #define TR_PREFS_KEY_PEER_CONGESTION_ALGORITHM "peer-congestion-algorithm" 181 182 #define TR_PREFS_KEY_PEX_ENABLED "pex-enabled" 182 183 #define TR_PREFS_KEY_PORT_FORWARDING "port-forwarding-enabled"
Note: See TracChangeset
for help on using the changeset viewer.