Changeset 7069
- Timestamp:
- Nov 8, 2008, 2:49:04 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/cli.c
r6978 r7069 283 283 st->peersSendingToUs, 284 284 st->peersConnected, 285 st-> rateDownload,285 st->pieceDownloadSpeed, 286 286 st->peersGettingFromUs, 287 st-> rateUpload,287 st->pieceUploadSpeed, 288 288 ratioStr ); 289 289 } … … 296 296 "Seeding, uploading to %d of %d peer(s), %.0f KB/s [%s]", 297 297 st->peersGettingFromUs, st->peersConnected, 298 st-> rateUpload, ratioStr );298 st->pieceUploadSpeed, ratioStr ); 299 299 } 300 300 else *buf = '\0'; -
trunk/gtk/torrent-cell-renderer.c
r6998 r7069 109 109 110 110 if( haveDown ) 111 tr_strlspeed( downStr, torStat-> rateDownload, sizeof( downStr ) );111 tr_strlspeed( downStr, torStat->pieceDownloadSpeed, sizeof( downStr ) ); 112 112 if( haveUp ) 113 tr_strlspeed( upStr, torStat-> rateUpload, sizeof( upStr ) );113 tr_strlspeed( upStr, torStat->pieceUploadSpeed, sizeof( upStr ) ); 114 114 115 115 if( haveDown && haveUp ) -
trunk/gtk/tr-core.c
r6978 r7069 309 309 sb = tr_torrentStatCached( tb ); 310 310 311 if( ( i = compareDouble( sa-> rateUpload + sa->rateDownload,312 sb-> rateUpload + sb->rateDownload ) ) )311 if( ( i = compareDouble( sa->pieceUploadSpeed + sa->pieceDownloadSpeed, 312 sb->pieceUploadSpeed + sb->pieceDownloadSpeed ) ) ) 313 313 return i; 314 314 … … 746 746 if( !isDisposed( core ) ) 747 747 { 748 tr_session GetSpeed( core->priv->session,749 &setme->clientDownloadSpeed, 750 &setme->clientUploadSpeed);751 752 gtk_tree_model_foreach( core->priv->model,753 statsForeach, 754 748 tr_session * session = core->priv->session; 749 750 setme->clientDownloadSpeed = tr_sessionGetPieceSpeed( session, TR_DOWN ); 751 752 setme->clientUploadSpeed = tr_sessionGetPieceSpeed( session, TR_UP ); 753 754 gtk_tree_model_foreach( core->priv->model, statsForeach, setme ); 755 755 } 756 756 } -
trunk/gtk/tr-window.c
r6998 r7069 770 770 updateSpeeds( PrivateData * p ) 771 771 { 772 char buf[128];773 float u, d;774 772 tr_session * session = tr_core_session( p->core ); 775 773 776 tr_sessionGetSpeed( session, &d, &u ); 777 tr_strlspeed( buf, d, sizeof( buf ) ); 778 gtk_label_set_text( GTK_LABEL( p->dl_lb ), buf ); 779 tr_strlspeed( buf, u, sizeof( buf ) ); 780 gtk_label_set_text( GTK_LABEL( p->ul_lb ), buf ); 774 if( session != NULL ) 775 { 776 char buf[128]; 777 double d; 778 779 d = tr_sessionGetPieceSpeed( session, TR_DOWN ); 780 tr_strlspeed( buf, d, sizeof( buf ) ); 781 gtk_label_set_text( GTK_LABEL( p->dl_lb ), buf ); 782 783 d = tr_sessionGetPieceSpeed( session, TR_UP ); 784 tr_strlspeed( buf, d, sizeof( buf ) ); 785 gtk_label_set_text( GTK_LABEL( p->ul_lb ), buf ); 786 } 781 787 } 782 788 -
trunk/libtransmission/peer-io.c
r7055 r7069 30 30 #include "net.h" 31 31 #include "peer-io.h" 32 #include "ratecontrol.h" 32 33 #include "trevent.h" 33 34 #include "utils.h" … … 204 205 b->bytesLeft -= MIN( b->bytesLeft, (size_t)n ); 205 206 b->bytesUsed += n; 207 tr_rcTransferred( io->session->rawSpeed[TR_UP], n ); 206 208 dbgmsg( io, 207 209 "wrote %zu bytes to peer... upload bytesLeft is now %zu", … … 236 238 b->bytesLeft -= MIN( b->bytesLeft, (size_t)n ); 237 239 b->bytesUsed += n; 240 tr_rcTransferred( io->session->rawSpeed[TR_DOWN], n ); 238 241 dbgmsg( io, 239 242 "%zu new input bytes. bytesUsed is %zu, bytesLeft is %zu", -
trunk/libtransmission/peer-mgr.c
r7065 r7069 55 55 /* how frequently to decide which peers live and die */ 56 56 RECONNECT_PERIOD_MSEC = ( 2 * 1000 ), 57 58 /* how frequently to reallocate bandwidth */ 59 BANDWIDTH_PERIOD_MSEC = 250, 57 60 58 61 /* max # of peers to ask fer per torrent per reconnect pulse */ … … 124 127 struct tr_peerMgr 125 128 { 126 uint8_t bandwidthPulseNumber; 127 tr_session * session; 128 tr_ptrArray * torrents; /* Torrent */ 129 tr_ptrArray * incomingHandshakes; /* tr_handshake */ 130 tr_timer * bandwidthTimer; 131 double globalPoolHistory[2][BANDWIDTH_PULSE_HISTORY]; 129 tr_session * session; 130 tr_ptrArray * torrents; /* Torrent */ 131 tr_ptrArray * incomingHandshakes; /* tr_handshake */ 132 tr_timer * bandwidthTimer; 133 tr_ratecontrol * globalPoolRawSpeed[2]; 132 134 }; 133 135 … … 506 508 static int bandwidthPulse( void * vmgr ); 507 509 510 508 511 tr_peerMgr* 509 512 tr_peerMgrNew( tr_session * session ) … … 514 517 m->torrents = tr_ptrArrayNew( ); 515 518 m->incomingHandshakes = tr_ptrArrayNew( ); 516 m-> bandwidthPulseNumber = -1;517 m-> bandwidthTimer = tr_timerNew( session, bandwidthPulse,518 m, 1000 / BANDWIDTH_PULSES_PER_SECOND);519 m->globalPoolRawSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( ); 520 m->globalPoolRawSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( ); 521 m->bandwidthTimer = tr_timerNew( session, bandwidthPulse, m, BANDWIDTH_PERIOD_MSEC ); 519 522 return m; 520 523 } … … 526 529 527 530 tr_timerFree( &manager->bandwidthTimer ); 531 tr_rcClose( manager->globalPoolRawSpeed[TR_CLIENT_TO_PEER] ); 532 tr_rcClose( manager->globalPoolRawSpeed[TR_PEER_TO_CLIENT] ); 528 533 529 534 /* free the handshakes. Abort invokes handshakeDoneCB(), which removes … … 2327 2332 2328 2333 static double 2329 allocateHowMuch( double desiredAvgKB, 2330 const double * history ) 2331 { 2332 const double baseline = desiredAvgKB * 1024.0 / 2333 BANDWIDTH_PULSES_PER_SECOND; 2334 const double min = baseline * 0.85; 2335 const double max = baseline * 1.15; 2336 int i; 2337 double usedBytes; 2338 double n; 2339 double clamped; 2340 2341 for( usedBytes = i = 0; i < BANDWIDTH_PULSE_HISTORY; ++i ) 2342 usedBytes += history[i]; 2343 2344 n = ( desiredAvgKB * 1024.0 ) 2345 * ( BANDWIDTH_PULSE_HISTORY + 1.0 ) 2346 / BANDWIDTH_PULSES_PER_SECOND 2347 - usedBytes; 2334 allocateHowMuch( double desired_average_kb_per_sec, 2335 const tr_ratecontrol * ratecontrol ) 2336 { 2337 const int pulses_per_history = TR_RATECONTROL_HISTORY_MSEC / BANDWIDTH_PERIOD_MSEC; 2338 const double seconds_per_pulse = BANDWIDTH_PERIOD_MSEC / 1000.0; 2339 const double baseline_bytes_per_pulse = desired_average_kb_per_sec * 1024.0 * seconds_per_pulse; 2340 const double min = baseline_bytes_per_pulse * 0.85; 2341 const double max = baseline_bytes_per_pulse * 1.15; 2342 const double current_bytes_per_pulse = tr_rcRate( ratecontrol ) * 1024.0 * seconds_per_pulse; 2343 const double next_pulse_bytes = baseline_bytes_per_pulse * ( pulses_per_history + 1 ) 2344 - ( current_bytes_per_pulse * pulses_per_history ); 2345 double clamped; 2348 2346 2349 2347 /* clamp the return value to lessen oscillation */ 2350 clamped = n ;2348 clamped = next_pulse_bytes; 2351 2349 clamped = MAX( clamped, min ); 2352 2350 clamped = MIN( clamped, max ); 2353 /*fprintf( stderr, "desiredAvgKB is %.2f, rate is %.2f, allocating %.2f 2354 (%.2f)\n", desiredAvgKB, 2355 ((usedBytes*BANDWIDTH_PULSES_PER_SECOND)/BANDWIDTH_PULSE_HISTORY)/1024.0, 2356 clamped/1024.0, n/1024.0 );*/ 2351 2352 fprintf( stderr, "desiredAvgKB is %.2f, rate is %.2f, allocating %.2f (%.2f)\n", 2353 desired_average_kb_per_sec, 2354 tr_rcRate( ratecontrol ), 2355 clamped/1024.0, 2356 next_pulse_bytes/1024.0 ); 2357 2357 2358 return clamped; 2358 2359 } … … 2367 2368 */ 2368 2369 static void 2369 setPeerBandwidth( tr_ptrArray *peerArray,2370 const tr_direction direction,2371 const double * history,2372 double desiredAvgKB )2370 setPeerBandwidth( tr_ptrArray * peerArray, 2371 const tr_direction direction, 2372 const tr_ratecontrol * ratecontrol, 2373 double desiredAvgKB ) 2373 2374 { 2374 2375 const int peerCount = tr_ptrArraySize( peerArray ); 2375 const double bytes = allocateHowMuch( desiredAvgKB, history);2376 const double bytes = allocateHowMuch( desiredAvgKB, ratecontrol ); 2376 2377 const double welfareBytes = MIN( 2048, bytes * 0.2 ); 2377 2378 const double meritBytes = MAX( 0, bytes - welfareBytes ); … … 2490 2491 { 2491 2492 tr_session * session = mgr->session; 2492 const int pulseNumber = mgr->bandwidthPulseNumber;2493 2493 const int torrentCount = tr_ptrArraySize( mgr->torrents ); 2494 2494 Torrent ** torrents = (Torrent **) tr_ptrArrayBase( mgr->torrents ); … … 2504 2504 pumpAllPeers( mgr ); 2505 2505 2506 for( i = 0; i <torrentCount; ++i )2506 for( i=0; i<torrentCount; ++i ) 2507 2507 { 2508 2508 Torrent * t = torrents[i]; 2509 const size_t used = countPeerBandwidth( t->peers, direction );2509 size_t used; 2510 2510 tr_speedlimit speedMode; 2511 2511 2512 /* no point in allocating bandwidth for stopped torrents */ 2513 if( tr_torrentGetActivity( t->tor ) == TR_STATUS_STOPPED ) 2514 continue; 2515 2516 used = countPeerBandwidth( t->peers, direction ); 2512 2517 countHandshakeBandwidth( t->outgoingHandshakes, direction ); 2513 2518 2514 2519 /* remember this torrent's bytes used */ 2515 t ->tor->rateHistory[direction][pulseNumber] = used;2520 tr_rcTransferred( t->tor->rawSpeed[direction], used ); 2516 2521 2517 2522 /* add this torrent's bandwidth use to allBytesUsed */ … … 2534 2539 case TR_SPEEDLIMIT_SINGLE: 2535 2540 setPeerBandwidth( t->peers, direction, 2536 t->tor->rateHistory[direction], 2537 tr_torrentGetSpeedLimit( t->tor, 2538 direction ) ); 2541 t->tor->rawSpeed[direction], 2542 tr_torrentGetSpeedLimit( t->tor, direction ) ); 2539 2543 break; 2540 2544 … … 2557 2561 poolBytesUsed += i; 2558 2562 2559 mgr->globalPoolHistory[direction][pulseNumber] = poolBytesUsed;2563 tr_rcTransferred( mgr->globalPoolRawSpeed[direction], poolBytesUsed ); 2560 2564 2561 2565 /* handle the global pool's connections */ … … 2564 2568 else 2565 2569 setPeerBandwidth( globalPool, direction, 2566 mgr->globalPoolHistory[direction],2567 tr_sessionGetSpeedLimit( session, direction ) );2570 mgr->globalPoolRawSpeed[direction], 2571 tr_sessionGetSpeedLimit( session, direction ) ); 2568 2572 2569 2573 /* now that we've allocated bandwidth, pump all the connected peers */ … … 2583 2587 managerLock( mgr ); 2584 2588 2585 /* keep track of how far we are into the cycle */2586 if( ++mgr->bandwidthPulseNumber == BANDWIDTH_PULSE_HISTORY )2587 mgr->bandwidthPulseNumber = 0;2588 2589 2589 /* allocate the upload and download bandwidth */ 2590 2590 for( i = 0; i < 2; ++i ) -
trunk/libtransmission/ratecontrol.c
r6857 r7069 30 30 #include "utils.h" 31 31 32 #define INTERVAL_MSEC 1000 33 #define GRANULARITY_MSEC 200 34 #define HISTORY_SIZE ( INTERVAL_MSEC / GRANULARITY_MSEC ) 32 enum 33 { 34 INTERVAL_MSEC = TR_RATECONTROL_HISTORY_MSEC, 35 36 GRANULARITY_MSEC = 250, 37 38 HISTORY_SIZE = ( INTERVAL_MSEC / GRANULARITY_MSEC ) 39 }; 35 40 36 41 struct tr_transfer -
trunk/libtransmission/ratecontrol.h
r7055 r7069 26 26 #define _TR_RATECONTROL_H_ 27 27 28 enum 29 { 30 TR_RATECONTROL_HISTORY_MSEC = 2000 31 }; 32 28 33 typedef struct tr_ratecontrol tr_ratecontrol; 29 34 -
trunk/libtransmission/rpcimpl.c
r6935 r7069 362 362 } 363 363 else if( !strcmp( key, "rateDownload" ) ) 364 tr_bencDictAddInt( d, key, (int)( st-> rateDownload * 1024 ) );364 tr_bencDictAddInt( d, key, (int)( st->pieceDownloadSpeed * 1024 ) ); 365 365 else if( !strcmp( key, "rateUpload" ) ) 366 tr_bencDictAddInt( d, key, (int)( st-> rateUpload * 1024 ) );366 tr_bencDictAddInt( d, key, (int)( st->pieceUploadSpeed * 1024 ) ); 367 367 else if( !strcmp( key, "recheckProgress" ) ) 368 368 tr_bencDictAddDouble( d, key, st->recheckProgress ); … … 683 683 tr_benc * d = tr_bencDictAddDict( args_out, "session-stats", 10 ); 684 684 tr_torrent * tor = NULL; 685 float up, down;686 685 int running = 0; 687 686 int total = 0; 688 687 689 tr_sessionGetSpeed( h, &down, &up );690 688 while( ( tor = tr_torrentNext( h, tor ) ) ) 691 689 { … … 696 694 697 695 tr_bencDictAddInt( d, "activeTorrentCount", running ); 698 tr_bencDictAddInt( d, "downloadSpeed", (int)( down* 1024 ) );696 tr_bencDictAddInt( d, "downloadSpeed", (int)( tr_sessionGetPieceSpeed( h, TR_DOWN ) * 1024 ) ); 699 697 tr_bencDictAddInt( d, "pausedTorrentCount", total - running ); 700 698 tr_bencDictAddInt( d, "torrentCount", total ); 701 tr_bencDictAddInt( d, "uploadSpeed", (int)( up* 1024 ) );699 tr_bencDictAddInt( d, "uploadSpeed", (int)( tr_sessionGetPieceSpeed( h, TR_UP ) * 1024 ) ); 702 700 return NULL; 703 701 } -
trunk/libtransmission/session.c
r7055 r7069 257 257 h->pieceSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( ); 258 258 h->pieceSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( ); 259 h->rawSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( ); 260 h->rawSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( ); 259 261 260 262 if( configDir == NULL ) … … 501 503 ***/ 502 504 503 void 504 tr_sessionGetSpeed( const tr_handle * session, 505 float * toClient, 506 float * toPeer ) 507 { 508 if( session && toClient ) 509 *toClient = tr_rcRate( session->pieceSpeed[TR_PEER_TO_CLIENT] ); 510 511 if( session && toPeer ) 512 *toPeer = tr_rcRate( session->pieceSpeed[TR_CLIENT_TO_PEER] ); 505 double 506 tr_sessionGetPieceSpeed( const tr_session * session, tr_direction dir ) 507 { 508 assert( dir==TR_UP || dir==TR_DOWN ); 509 510 return session ? tr_rcRate( session->pieceSpeed[dir] ) : 0.0; 511 } 512 513 double 514 tr_sessionGetRawSpeed( const tr_session * session, tr_direction dir ) 515 { 516 assert( dir==TR_UP || dir==TR_DOWN ); 517 518 return session ? tr_rcRate( session->rawSpeed[dir] ) : 0.0; 513 519 } 514 520 … … 626 632 tr_rcClose( session->pieceSpeed[TR_PEER_TO_CLIENT] ); 627 633 tr_rcClose( session->pieceSpeed[TR_CLIENT_TO_PEER] ); 634 tr_rcClose( session->rawSpeed[TR_PEER_TO_CLIENT] ); 635 tr_rcClose( session->rawSpeed[TR_CLIENT_TO_PEER] ); 628 636 tr_lockFree( session->lock ); 629 637 for( i = 0; i < session->metainfoLookupCount; ++i ) -
trunk/libtransmission/session.h
r7055 r7069 35 35 #endif 36 36 #endif 37 38 enum39 {40 /* How frequently to reallocate peer bandwidth. */41 BANDWIDTH_PULSES_PER_SECOND = 4,42 43 /* HOw many pulses to remember for averaging the current speed */44 BANDWIDTH_PULSE_HISTORY = ( BANDWIDTH_PULSES_PER_SECOND * 2 )45 };46 37 47 38 … … 118 109 * protocol overhead is NOT included; this is only the piece data */ 119 110 struct tr_ratecontrol * pieceSpeed[2]; 111 112 /* the rate at which bytes are being transferred between client and peer. */ 113 struct tr_ratecontrol * rawSpeed[2]; 120 114 }; 121 115 -
trunk/libtransmission/torrent.c
r7065 r7069 497 497 randomizeTiers( info ); 498 498 499 tor->rawSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( ); 500 tor->rawSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( ); 499 501 tor->pieceSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( ); 500 502 tor->pieceSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( ); … … 745 747 { 746 748 return tor ? &tor->info : NULL; 747 }748 749 static double750 tr_torrentGetRate( const tr_torrent * tor,751 tr_direction direction )752 {753 assert( tor != NULL );754 assert( direction == TR_UP || direction == TR_DOWN );755 756 return tr_rcRate( tor->pieceSpeed[direction] );757 749 } 758 750 … … 823 815 s->peersFrom ); 824 816 825 s->rateDownload = tr_torrentGetRate( tor, TR_PEER_TO_CLIENT ); 826 827 s->rateUpload = tr_torrentGetRate( tor, TR_CLIENT_TO_PEER ); 817 s->rawUploadSpeed = tr_rcRate( tor->rawSpeed[TR_UP] ); 818 s->rawDownloadSpeed = tr_rcRate( tor->rawSpeed[TR_DOWN] ); 819 s->pieceUploadSpeed = tr_rcRate( tor->pieceSpeed[TR_UP] ); 820 s->pieceDownloadSpeed = tr_rcRate( tor->pieceSpeed[TR_DOWN] ); 828 821 829 822 usableSeeds += tor->info.webseedCount; … … 881 874 if( s->leftUntilDone > s->desiredAvailable ) 882 875 s->eta = TR_ETA_NOT_AVAIL; 883 else if( s-> rateDownload < 0.1 )876 else if( s->pieceDownloadSpeed < 0.1 ) 884 877 s->eta = TR_ETA_UNKNOWN; 885 878 else 886 s->eta = s->leftUntilDone / s-> rateDownload / 1024.0;879 s->eta = s->leftUntilDone / s->pieceDownloadSpeed / 1024.0; 887 880 888 881 s->ratio = tr_getRatio( … … 1110 1103 tr_rcClose( tor->pieceSpeed[TR_PEER_TO_CLIENT] ); 1111 1104 tr_rcClose( tor->pieceSpeed[TR_CLIENT_TO_PEER] ); 1105 tr_rcClose( tor->rawSpeed[TR_PEER_TO_CLIENT] ); 1106 tr_rcClose( tor->rawSpeed[TR_CLIENT_TO_PEER] ); 1112 1107 1113 1108 tr_metainfoFree( inf ); -
trunk/libtransmission/torrent.h
r7065 r7069 230 230 int uniqueId; 231 231 232 /* this is the count of raw bytes transferred between the233 * client and its peers over the past HISTORY time slices.234 * this count is used for bandwidth allocation, and includes235 * piece data, protocol overhead, and estimated tcp header overhead. */236 double rateHistory[2][BANDWIDTH_PULSE_HISTORY];237 238 232 /* the rate at which pieces are being transferred between client and 239 233 * its peers. protocol overhead is NOT included; only the piece data */ 240 234 struct tr_ratecontrol * pieceSpeed[2]; 235 236 /* the rate at which bytes are being sent between client and peers */ 237 struct tr_ratecontrol * rawSpeed[2]; 241 238 }; 242 239 -
trunk/libtransmission/transmission.h
r7051 r7069 560 560 int isEnabled ); 561 561 562 void tr_sessionGetSpeed( const tr_session * session, 563 float * overall_down_KiBs, 564 float * overall_up_KiBs ); 562 double tr_sessionGetRawSpeed( const tr_session * session, 563 tr_direction direection ); 564 565 double tr_sessionGetPieceSpeed( const tr_session * session, 566 tr_direction direection ); 565 567 566 568 int tr_sessionIsSpeedLimitEnabled( const tr_session * session, … … 1185 1187 tr_torrent_activity; 1186 1188 1189 tr_torrent_activity tr_torrentGetActivity( tr_torrent * ); 1190 1187 1191 #define TR_STATUS_IS_ACTIVE( s ) ( ( s ) != TR_STATUS_STOPPED ) 1188 1192 … … 1194 1198 } 1195 1199 tr_lockfile_state_t; 1196 1197 tr_torrent_activity tr_torrentGetActivity( tr_torrent * );1198 1200 1199 1201 enum … … 1257 1259 float percentDone; 1258 1260 1259 /** Download speed in KiB/s */ 1260 double rateDownload; 1261 1262 /** Upload speed in KiB/s */ 1263 double rateUpload; 1261 /** Speed all data being sent for this torrent. (KiB/s) 1262 This includes piece data, protocol messages, and TCP overhead */ 1263 double rawUploadSpeed; 1264 1265 /** Speed all data being received for this torrent. (KiB/s) 1266 This includes piece data, protocol messages, and TCP overhead */ 1267 double rawDownloadSpeed; 1268 1269 /** Speed all piece being sent for this torrent. (KiB/s) 1270 This ONLY counts piece data. */ 1271 double pieceUploadSpeed; 1272 1273 /** Speed all piece being received for this torrent. (KiB/s) 1274 This ONLY counts piece data. */ 1275 double pieceDownloadSpeed; 1264 1276 1265 1277 #define TR_ETA_NOT_AVAIL -1 -
trunk/macosx/Badger.m
r6995 r7069 86 86 if ([NSApp isOnLeopardOrBetter]) 87 87 { 88 float downloadRate = 0.0, uploadRate = 0.0;89 88 BOOL badgeDownload = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeDownloadRate"], 90 89 badgeUpload = [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeUploadRate"]; 91 if (badgeDownload || badgeUpload)92 tr_sessionGetSpeed(fLib, badgeDownload ? &downloadRate : NULL, badgeUpload ? &uploadRate : NULL);90 float downloadRate = badgeDownload ? tr_sessionGetPieceSpeed( fLib, TR_DOWN ) : 0.0f; 91 float uploadRate = badgeUpload ? tr_sessionGetPieceSpeed( fLib, TR_UP ) : 0.0f; 93 92 94 93 //only update if the badged values change … … 153 152 NSString * downloadRateString = nil, * uploadRateString = nil; 154 153 155 float downloadRate , uploadRate;156 tr_sessionGetSpeed(fLib, &downloadRate, &uploadRate);154 float downloadRate = tr_sessionGetPieceSpeed( fLib, TR_DOWN ); 155 float uploadRate = tr_sessionGetPieceSpeed( fLib, TR_UP ); 157 156 158 157 if (checkDownload && downloadRate >= 0.1) -
trunk/macosx/Controller.m
r7047 r7069 1508 1508 { 1509 1509 //set rates 1510 float downloadRate , uploadRate;1511 tr_sessionGetSpeed(fLib, &downloadRate, &uploadRate);1510 float downloadRate = tr_sessionGetPieceSpeed( fLib, TR_DOWN ); 1511 float uploadRate = tr_sessionGetPieceSpeed( fLib, TR_UP ); 1512 1512 1513 1513 [fTotalDLField setStringValue: [NSString stringForSpeed: downloadRate]]; -
trunk/macosx/Torrent.m
r7059 r7069 1312 1312 - (CGFloat) downloadRate 1313 1313 { 1314 return fStat-> rateDownload;1314 return fStat->pieceDownloadSpeed; 1315 1315 } 1316 1316 1317 1317 - (CGFloat) uploadRate 1318 1318 { 1319 return fStat-> rateUpload;1319 return fStat->pieceUploadSpeed; 1320 1320 } 1321 1321
Note: See TracChangeset
for help on using the changeset viewer.