Changeset 2221
- Timestamp:
- Jun 28, 2007, 5:43:53 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/tr_torrent.c
r2206 r2221 238 238 } 239 239 240 static tr_stat_t* 241 refreshStat( TrTorrent * tor ) 242 { 243 tor->lastStatTime= time( NULL ); 244 tor->stat = *tr_torrentStat( tor->handle ); 245 return &tor->stat; 246 } 247 240 248 const tr_stat_t * 241 249 tr_torrent_stat(TrTorrent *tor) 242 250 { 243 const time_t now = time( NULL );244 245 251 g_assert( TR_IS_TORRENT(tor) ); 246 252 247 if( tor->severed ) 248 return NULL; 249 250 if( tor->lastStatTime != now ) { 251 tor->lastStatTime = now; 252 tor->stat = *tr_torrentStat( tor->handle ); 253 } 253 if( !tor->severed && tor->lastStatTime!=time(NULL) ) 254 refreshStat( tor ); 254 255 255 256 return &tor->stat; … … 401 402 402 403 torrent = hash = dir = NULL; 403 paused = FALSE;404 404 405 405 for(ii = 0; ii + 1 < state->val.l.count; ii += 2) { … … 428 428 429 429 flags = 0; 430 if( forcedpause )430 if( paused || forcedpause ) 431 431 flags |= TR_FLAG_PAUSED; 432 432 … … 494 494 tr_bencInitStr( tr_bencDictAdd( state, "dir" ), 495 495 tr_torrentGetFolder( tor->handle ), -1, 1 ); 496 #if 0 496 497 497 tr_bencInitInt( tr_bencDictAdd( state, "paused" ), 498 tr_torrent_paused( tor ) ? 1 : 0 ); 499 #endif 500 498 (refreshStat(tor)->status & TR_STATUS_INACTIVE) ? 1 : 0); 501 499 tr_bencInitInt( tr_bencDictAdd( state, "ul-cap-speed" ), 502 500 tor->ul_cap ); -
trunk/libtransmission/torrent.c
r2216 r2221 25 25 #include "transmission.h" 26 26 #include "shared.h" 27 #define INTERVAL_MSEC 10028 27 29 28 /*** … … 824 823 tr_peer_t * otherPeer; 825 824 825 assert( tor != NULL ); 826 assert( peer != NULL ); 827 826 828 if( tor->peerCount >= TR_MAX_PEER_COUNT ) 827 829 { … … 952 954 953 955 /* sleep a little while */ 954 tr_wait( INTERVAL_MSEC);956 tr_wait( tor->runStatus == TR_RUN_STOPPED ? 1000 : 100 ); 955 957 956 958 /* if we're stopping... */
Note: See TracChangeset
for help on using the changeset viewer.