Changeset 10972
- Timestamp:
- Jul 7, 2010, 11:37:03 PM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/session.c
r10945 r10972 315 315 tr_bencDictReserve( d, 60 ); 316 316 tr_bencDictAddBool( d, TR_PREFS_KEY_BLOCKLIST_ENABLED, tr_blocklistIsEnabled( s ) ); 317 tr_bencDictAddInt ( d, TR_PREFS_KEY_MAX_CACHE_SIZE_MB, tr_ cacheGetLimit( s->cache) );317 tr_bencDictAddInt ( d, TR_PREFS_KEY_MAX_CACHE_SIZE_MB, tr_sessionGetCacheLimit_MB( s ) ); 318 318 tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED, s->isDHTEnabled ); 319 319 tr_bencDictAddBool( d, TR_PREFS_KEY_LPD_ENABLED, s->isLPDEnabled ); … … 1894 1894 1895 1895 void 1896 tr_sessionSetCacheLimit_B( tr_session * session, uint64_t max_bytes ) 1897 { 1898 assert( tr_isSession( session ) ); 1899 1900 tr_cacheSetLimit( session->cache, max_bytes ); 1901 } 1902 void 1903 tr_sessionSetCacheLimit_MB( tr_session * session, int MB ) 1904 { 1905 tr_sessionSetCacheLimit_B( session, toMemBytes( MB ) ); 1906 } 1907 1908 uint64_t 1909 tr_sessionGetCacheLimit_B( const tr_session * session ) 1910 { 1911 assert( tr_isSession( session ) ); 1912 1913 return tr_cacheGetLimit( session->cache ); 1914 } 1896 tr_sessionSetCacheLimit_MB( tr_session * session, int max_bytes ) 1897 { 1898 assert( tr_isSession( session ) ); 1899 1900 tr_cacheSetLimit( session->cache, toMemBytes( max_bytes ) ); 1901 } 1902 1915 1903 int 1916 1904 tr_sessionGetCacheLimit_MB( const tr_session * session ) 1917 1905 { 1918 return toMemMB( tr_sessionGetCacheLimit_B( session ) ); 1919 } 1920 1906 assert( tr_isSession( session ) ); 1907 1908 return toMemMB( tr_cacheGetLimit( session->cache ) ); 1909 } 1921 1910 1922 1911 /*** -
trunk/libtransmission/session.h
r10945 r10972 274 274 275 275 static inline uint64_t toMemBytes ( unsigned int MB ) { uint64_t B = tr_mem_K * tr_mem_K; B *= MB; return B; } 276 static inline int toMemMB ( uint64_t B ) { return B / tr_mem_K; }276 static inline int toMemMB ( uint64_t B ) { return B / ( tr_mem_K * tr_mem_K ); } 277 277 278 278 /** 279 279 **/ 280 281 void tr_sessionSetCacheLimit_B ( tr_session * session, uint64_t B );282 uint64_t tr_sessionGetCacheLimit_B ( const tr_session * session );283 280 284 281 int tr_sessionGetSpeedLimit_Bps( const tr_session *, tr_direction );
Note: See TracChangeset
for help on using the changeset viewer.