Show
Ignore:
Timestamp:
05/05/08 15:16:26 (4 years ago)
Author:
rakshasa
Message:

* Initial seeding support added. Patch by Josef Drexler.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/libtorrent/src/protocol/handshake.cc

    r1034 r1058  
    527527  // The download is just starting so we're not sending any 
    528528  // bitfield. Pretend we wrote it already. 
    529   if (m_download->file_list()->bitfield()->is_all_unset()) 
     529  if (m_download->file_list()->bitfield()->is_all_unset() || m_download->initial_seeding() != NULL) { 
    530530    m_writePos = m_download->file_list()->bitfield()->size_bytes(); 
    531   else 
     531    m_writeBuffer.write_32(0); 
     532 
     533    if (m_encryption.info()->is_encrypted()) 
     534      m_encryption.info()->encrypt(m_writeBuffer.end() - 4, 4); 
     535 
     536  } else { 
    532537    prepare_bitfield(); 
     538  } 
    533539 
    534540  m_state = READ_MESSAGE; 
     
    622628  // bitfield to send, we need to send a keep-alive now. 
    623629  if (m_writePos == m_download->file_list()->bitfield()->size_bytes()) 
    624     prepare_post_handshake(m_download->file_list()->bitfield()->is_all_unset()); 
     630    prepare_post_handshake(m_download->file_list()->bitfield()->is_all_unset() || m_download->initial_seeding() != NULL); 
    625631 
    626632  if (m_writeDone)