Show
Ignore:
Timestamp:
11/04/06 11:05:28 (6 years ago)
Author:
rakshasa
Message:

* Properly nul-terminate the info hash and client id in the tracker
request.

* Implemented options for read-ahead of
chunks. 'preload_min_pipelined', 'preload_min_size' and
'preload_required_rate' are used to decide when to read-ahead a chunk.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/libtorrent/src/torrent/chunk_manager.h

    r798 r800  
    6161  // usage to a resonable value. This should be based on the arch, 
    6262  // ulimit and errors encountered when mmap'ing. 
    63   bool                auto_memory() const                     { return m_autoMemory; } 
    64   void                set_auto_memory(bool state)             { m_autoMemory = state; } 
     63  bool                auto_memory() const                       { return m_autoMemory; } 
     64  void                set_auto_memory(bool state)               { m_autoMemory = state; } 
    6565 
    66   uint64_t            memory_usage() const                    { return m_memoryUsage; } 
     66  uint64_t            memory_usage() const                      { return m_memoryUsage; } 
    6767 
    6868  // Should we allow the client to reserve some memory? 
    6969 
    7070  // The client should set this automatically if ulimit is set. 
    71   uint64_t            max_memory_usage() const                { return m_maxMemoryUsage; } 
    72   void                set_max_memory_usage(uint64_t bytes)    { m_maxMemoryUsage = bytes; } 
     71  uint64_t            max_memory_usage() const                  { return m_maxMemoryUsage; } 
     72  void                set_max_memory_usage(uint64_t bytes)      { m_maxMemoryUsage = bytes; } 
    7373 
    7474  // Estimate the max memory usage possible, capped at 1GB. 
     
    7777  uint64_t            safe_free_diskspace() const; 
    7878 
    79   bool                safe_sync() const                       { return m_safeSync; } 
    80   void                set_safe_sync(uint32_t state)           { m_safeSync = state; } 
     79  bool                safe_sync() const                         { return m_safeSync; } 
     80  void                set_safe_sync(uint32_t state)             { m_safeSync = state; } 
    8181 
    8282  // Set the interval to wait after the last write to a chunk before 
    8383  // trying to sync it. By not forcing a sync too early it should give 
    8484  // the kernel an oppertunity to sync at its convenience. 
    85   uint32_t            timeout_sync() const                    { return m_timeoutSync; } 
    86   void                set_timeout_sync(uint32_t seconds)      { m_timeoutSync = seconds; } 
     85  uint32_t            timeout_sync() const                      { return m_timeoutSync; } 
     86  void                set_timeout_sync(uint32_t seconds)        { m_timeoutSync = seconds; } 
    8787 
    88   uint32_t            timeout_safe_sync() const               { return m_timeoutSafeSync; } 
    89   void                set_timeout_safe_sync(uint32_t seconds) { m_timeoutSafeSync = seconds; } 
     88  uint32_t            timeout_safe_sync() const                 { return m_timeoutSafeSync; } 
     89  void                set_timeout_safe_sync(uint32_t seconds)   { m_timeoutSafeSync = seconds; } 
     90 
     91  // Set to 0 to disable preloading. 
     92  // 
     93  // How the value is used is yet to be determined, but it won't be 
     94  // able to use actual requests in the request queue as we can easily 
     95  // stay ahead of it causing preloading to fail. 
     96  uint32_t            preload_min_pipelined() const             { return m_preloadMinPipelined; } 
     97  void                set_preload_min_pipelined(uint32_t size)  { m_preloadMinPipelined = size; } 
     98 
     99  uint32_t            preload_min_size() const                  { return m_preloadMinSize; } 
     100  void                set_preload_min_size(uint32_t bytes)      { m_preloadMinSize = bytes; } 
     101 
     102  // Required rate before attempting to preload chunk, per whole 
     103  // megabyte of chunk size. 
     104  uint32_t            preload_required_rate() const             { return m_preloadRequiredRate; } 
     105  void                set_preload_required_rate(uint32_t bytes) { m_preloadRequiredRate = bytes; } 
    90106 
    91107  void                insert(ChunkList* chunkList); 
     
    119135  uint32_t            m_timeoutSafeSync; 
    120136 
     137  uint32_t            m_preloadMinPipelined; 
     138  uint32_t            m_preloadMinSize; 
     139  uint32_t            m_preloadRequiredRate; 
     140 
    121141  int32_t             m_timerStarved; 
    122142  size_type           m_lastFreed;