~ubuntu-branches/ubuntu/oneiric/libtorrent/oneiric

« back to all changes in this revision

Viewing changes to src/protocol/handshake.cc

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Hahler
  • Date: 2008-05-11 18:19:39 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20080511181939-9jvdv3ifbmr2a17o
Tags: 0.12.2-0ubuntu1
* New upstream release
* debian/patches/01-fix-gcc43.patch:
  Fix build with GCC 4.3, taken from bug report at
  http://libtorrent.rakshasa.no/ticket/1266.
  Patch by Philipp Reh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
526
526
 
527
527
  // The download is just starting so we're not sending any
528
528
  // 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) {
530
530
    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 {
532
537
    prepare_bitfield();
 
538
  }
533
539
 
534
540
  m_state = READ_MESSAGE;
535
541
  manager->poll()->insert_write(this);
621
627
  // still reading the bitfield/extension and postponed it. If we had no
622
628
  // bitfield to send, we need to send a keep-alive now.
623
629
  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);
625
631
 
626
632
  if (m_writeDone)
627
633
    throw handshake_succeeded();