Changeset 7144
- Timestamp:
- Nov 23, 2008, 5:40:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.4x/libtransmission/stats.c
r6896 r7144 11 11 */ 12 12 13 #include <assert.h>14 15 13 #include "transmission.h" 16 14 #include "bencode.h" … … 22 20 **** 23 21 ***/ 22 23 static struct tr_session_stats STATS_INIT = { 0.0f, 0, 0, 0, 0, 0 }; 24 24 25 25 struct tr_stats_handle … … 120 120 tr_statsClose( tr_handle * handle ) 121 121 { 122 tr_session_stats cumulative ;122 tr_session_stats cumulative = STATS_INIT; 123 123 124 124 tr_sessionGetCumulativeStats( handle, &cumulative ); … … 132 132 getStats( const tr_handle * handle ) 133 133 { 134 return handle ->sessionStats;134 return handle ? handle->sessionStats : NULL; 135 135 } 136 136 … … 164 164 { 165 165 const struct tr_stats_handle * stats = getStats( handle ); 166 167 assert( stats ); 168 *setme = stats->single; 169 setme->secondsActive = time( NULL ) - stats->startTime; 170 updateRatio( setme ); 166 if( stats ) 167 { 168 *setme = stats->single; 169 setme->secondsActive = time( NULL ) - stats->startTime; 170 updateRatio( setme ); 171 } 171 172 } 172 173 … … 176 177 { 177 178 const struct tr_stats_handle * stats = getStats( handle ); 178 tr_session_stats current; 179 180 assert( stats ); 181 tr_sessionGetStats( handle, ¤t ); 182 addStats( setme, &stats->old, ¤t ); 179 tr_session_stats current = STATS_INIT; 180 181 if( stats ) 182 { 183 tr_sessionGetStats( handle, ¤t ); 184 addStats( setme, &stats->old, ¤t ); 185 } 183 186 } 184 187
Note: See TracChangeset
for help on using the changeset viewer.