On Mon, 28 Nov 2016 13:45:38 +0200 Peter Pentchev <r...@ringlet.net> wrote: [...] > So, what do you think about the attached series of patches? > - the first three are actually meant to bring the Git repository in line > with what was uploaded as libtorrent-0.13.6-1 > - the next one starts a changelog entry just to have one, I'm not trying > to take over libtorrent or to force myself into any kind of maintainer > team or anything > - then there are a couple of fixes, with the changelog entries split out > into separate commits so that you can pick and choose as you wish
Hello Peter, thanks for your patches. I am willing to sponsor your fixes for libtorrent. However please provide a debdiff against the release in unstable next time. This makes it far easier to review your proposed changes. Also it would be better to split the release critical parts from the non-release critical parts but it's ok this time. I would like you to ask to get in contact with libtorrent's upstream first. Since this is a security sensitive patch, getting their approval is preferable. Unera filed issue 517 a while ago but it got almost immediately closed. https://github.com/rakshasa/rtorrent/issues/517 Please reopen it or file a new issue. As soon as upstream confirms that your patch is correct, please ping me again for the upload. Regards, Markus
diff -Nru libtorrent-0.13.6/debian/changelog libtorrent-0.13.6/debian/changelog --- libtorrent-0.13.6/debian/changelog 2015-09-30 06:05:48.000000000 +0200 +++ libtorrent-0.13.6/debian/changelog 2016-11-27 23:08:20.000000000 +0100 @@ -1,3 +1,19 @@ +libtorrent (0.13.6-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Explicitly add zlib to the build dependencies now that OpenSSL + no longer depends on it. + * Add the dh-openssl-1.1 patch to fix the compilation with OpenSSL 1.1 by + using an accessor function to store the generated DH parameters. + Closes: #828414 + * Declare compliance with Debian Policy 3.9.8 with no changes. + * Use the canonical anonscm.debian.org URLs for the Vcs-* fields. + * Switch various upstream and Debian URLs to the HTTPS scheme. + * Update the upstream copyright information for libtorrent-0.13.6. + * Add the typos patch to correct some typographical and grammatical errors. + + -- Peter Pentchev <r...@ringlet.net> Mon, 28 Nov 2016 00:08:20 +0200 + libtorrent (0.13.6-1) unstable; urgency=medium [ Jonathan McDowell ] diff -Nru libtorrent-0.13.6/debian/control libtorrent-0.13.6/debian/control --- libtorrent-0.13.6/debian/control 2015-09-29 07:41:20.000000000 +0200 +++ libtorrent-0.13.6/debian/control 2016-11-27 23:08:20.000000000 +0100 @@ -12,10 +12,11 @@ libcppunit-dev, libcurl4-openssl-dev, libsigc++-2.0-dev, - libssl-dev -Standards-Version: 3.9.6 -Vcs-git: git://git.debian.org/git/collab-maint/libtorrent.git -Vcs-browser: http://git.debian.org/?p=collab-maint/libtorrent.git;a=summary + libssl-dev, + zlib1g-dev +Standards-Version: 3.9.8 +Vcs-Git: https://anonscm.debian.org/git/collab-maint/libtorrent.git +Vcs-browser: https://anonscm.debian.org/cgit/collab-maint/libtorrent.git Homepage: https://rakshasa.github.io/rtorrent/ Package: libtorrent-dev diff -Nru libtorrent-0.13.6/debian/copyright libtorrent-0.13.6/debian/copyright --- libtorrent-0.13.6/debian/copyright 2015-09-29 07:40:13.000000000 +0200 +++ libtorrent-0.13.6/debian/copyright 2016-11-27 23:08:20.000000000 +0100 @@ -1,15 +1,16 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: LibTorrent Upstream-Contact: Jari Sundell <ja...@ifi.uio.no> -Source: http://libtorrent.rakshasa.no/ +Source: https://libtorrent.rakshasa.no/ Files: * Copyright: © 2005-2011 Jari Sundell <ja...@ifi.uio.no> License: GPL-2+ with OpenSSL exception -Files: ltmain.sh -Copyright: © 1996-2011 Free Software Foundation, Inc. -License: GPL-2+ +Files: scripts/ax_check_zlib.m4 +Copyright: © 2008 Loic Dachary <l...@senga.org> + © 2010 Bastien Chevreux <b...@chevreux.org> +License: GPL-2+ with OpenSSL exception Files: debian/* Copyright: © 2005-2006 Qingning Huo <q...@mayhq.co.uk> diff -Nru libtorrent-0.13.6/debian/patches/dh-openssl-1.1.patch libtorrent-0.13.6/debian/patches/dh-openssl-1.1.patch --- libtorrent-0.13.6/debian/patches/dh-openssl-1.1.patch 1970-01-01 01:00:00.000000000 +0100 +++ libtorrent-0.13.6/debian/patches/dh-openssl-1.1.patch 2016-11-27 23:08:20.000000000 +0100 @@ -0,0 +1,50 @@ +Description: Fix the DH parameters generation with OpenSSL 1.1. + The DH structure is now opaque, so the parameters must be stored there + through an accessor function. +Bug-Debian: https://bugs.debian.org/828414 +Forwarded: no +Author: Peter Pentchev <r...@ringlet.net> +Last-Update: 2016-11-28 + +--- a/src/utils/diffie_hellman.cc ++++ b/src/utils/diffie_hellman.cc +@@ -54,8 +54,11 @@ + + #ifdef USE_OPENSSL + m_dh = DH_new(); +- m_dh->p = BN_bin2bn(prime, primeLength, NULL); +- m_dh->g = BN_bin2bn(generator, generatorLength, NULL); ++ BIGNUM * const dh_p = BN_bin2bn(prime, primeLength, NULL); ++ BIGNUM * const dh_g = BN_bin2bn(generator, generatorLength, NULL); ++ if (dh_p == NULL || dh_g == NULL || ++ !DH_set0_pqg(m_dh, dh_p, NULL, dh_g)) ++ throw internal_error("Could not generate Diffie-Hellman parameters"); + + DH_generate_key(m_dh); + #else +@@ -73,7 +76,11 @@ + bool + DiffieHellman::is_valid() const { + #ifdef USE_OPENSSL +- return m_dh != NULL && m_dh->pub_key != NULL; ++ if (m_dh == NULL) ++ return false; ++ const BIGNUM *pub_key; ++ DH_get0_key(m_dh, &pub_key, NULL); ++ return pub_key != NULL; + #else + return false; + #endif +@@ -102,8 +109,10 @@ + #ifdef USE_OPENSSL + std::memset(dest, 0, length); + +- if ((int)length >= BN_num_bytes(m_dh->pub_key)) +- BN_bn2bin(m_dh->pub_key, dest + length - BN_num_bytes(m_dh->pub_key)); ++ const BIGNUM *pub_key; ++ DH_get0_key(m_dh, &pub_key, NULL); ++ if ((int)length >= BN_num_bytes(pub_key)) ++ BN_bn2bin(pub_key, dest + length - BN_num_bytes(pub_key)); + #endif + } + diff -Nru libtorrent-0.13.6/debian/patches/series libtorrent-0.13.6/debian/patches/series --- libtorrent-0.13.6/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ libtorrent-0.13.6/debian/patches/series 2016-11-27 23:08:20.000000000 +0100 @@ -0,0 +1,2 @@ +dh-openssl-1.1.patch +typos.patch diff -Nru libtorrent-0.13.6/debian/patches/typos.patch libtorrent-0.13.6/debian/patches/typos.patch --- libtorrent-0.13.6/debian/patches/typos.patch 1970-01-01 01:00:00.000000000 +0100 +++ libtorrent-0.13.6/debian/patches/typos.patch 2016-11-27 23:08:20.000000000 +0100 @@ -0,0 +1,918 @@ +Description: Correct some typographical and grammatical errors. +Forwarded: no +Author: Peter Pentchev <r...@ringlet.net> +Last-Update: 2016-11-28 + +--- a/TODO_LONGTERM ++++ b/TODO_LONGTERM +@@ -15,19 +15,19 @@ + Remove the old non-const rate functions in Download. + + Allow flags to be passed during creation of download. This would be +-used to f.ex deciding if a download should be considered a multi-file ++used to f.ex decide whether a download should be considered a multi-file + torrent or not. + + + === torrent::Object == + +-Ways of checking that they are a value and between a range. ++Ways of checking that they are a value and within a range. + + Make an union of two bencode streams. This will allow rtorrent to save + much smaller files with recent changes, and thus not require + re-constructing torrent files of ~100KB in some cases. + +-Add a variable that has can have an off state, plus a value range. ++Add a variable that can have an off state, plus a value range. + + Add a bit for modified entries, or perhaps just freeze lists/maps. + +@@ -53,12 +53,12 @@ + Currently a load is triggered every time for a bad torrent/duplicate + torrent. Fix this. + +-Consider tieing new files that match old torrents without a ++Consider tying new files that match old torrents without a + tied_to_file. + + == Delegator rework == + +-Keep multiple downloads of the same block seperate. When done, and ++Keep multiple downloads of the same block separate. When done, and + hash checking fails, compare pieces and merge/mark equal pieces. Those + would have higher priority when comparing, but not absolute. + +--- a/doc/http.xml ++++ b/doc/http.xml +@@ -16,7 +16,7 @@ + <para> + The torrent::Http class and the factory slot related functions can be + found in the header "torrent/http.h". The http handler should have +-reasonable connection timeouts, be non-blocking and not do reconnects ++reasonable connection timeouts, be non-blocking, and not do reconnects + on failed downloads. + </para> + +@@ -31,7 +31,7 @@ + may bind values to the arguments of their function to avoid depending + on globals. The factory slot must return a pointer to a new instance + with the base type torrent::Http, and the caller takes responsibility +-of deleting the object. (Note: consider making the cleanup a slot) ++for deleting the object. (Note: consider making the cleanup a slot) + </para> + + </section> +@@ -53,7 +53,7 @@ + <para> + Http::start is called by the library when it wishes to initiate a http + download. Your Http derived class must implement this function. It +-must be non-blocking and thread-safe. This means that if a seperate ++must be non-blocking and thread-safe. This means that if a separate + thread is used for downloading then it must not emit any signal while + the main thread is inside the library. + </para> +@@ -62,8 +62,8 @@ + <section id="close"><title>close</title> + + <para> +-Http::close is used bu the library to stop and close a download. No +-signals may be emited after this. Http::m_data should not be ++Http::close is used by the library to stop and close a download. No ++signals may be emitted after this. Http::m_data should not be + cleared. The library may clear the Http::m_data pointer after this. + </para> + +@@ -74,7 +74,7 @@ + There are two mutually exclusive signals that are called when the + download has stopped. The signal torrent::Http::m_signalDone is called + if the download was successful and torrent::Http::m_stream contains +-the complete data. Or if the download was unsuccessful for some ++the complete data. If the download was unsuccessful for some + reason, then torrent::Http::m_signalFailed is called with an error + message. + </para> +@@ -82,4 +82,4 @@ + + </section> + +-</chapter> +\ No newline at end of file ++</chapter> +--- a/doc/torrent.xml ++++ b/doc/torrent.xml +@@ -9,7 +9,7 @@ + This is the initial state of a download. When switching to this mode, + all tracker requests are closed and the bitfield of completed chunks + is cleared. File paths can only be changed in this state. Functions +-for getting information on bitfields, chunk count and various others ++for getting information on bitfields, chunk count, and various others + will return size 0 in this state. (TODO: Check which) + </para> + +@@ -28,8 +28,8 @@ + <section id="open"> <title>Open</title> + + <para> +-This is the state after a successfull call to +-torrent::Download::open(). This function throws torrent::local_error ++This is the state after a successful call to ++torrent::Download::open(). This function throws a torrent::local_error + if the download could not be opened. All files in the download have + been created and are open. The initial hash check must be done to get + a valid bitfield of completed chunks. +@@ -50,7 +50,7 @@ + + <para> + A download is active after calling torrent::Download::start(). Only +-downloads that are in an open state and has a valid bitfield of ++downloads that are in an open state and have a valid bitfield of + completed chunks can be activated. + </para> + +@@ -68,7 +68,7 @@ + A tracker request will be made when torrent::Download::stop() is + called on an active download. It is not required to wait for the + tracker request to finish before calling torrent::Download::close(), +-but it is recommened so the tracker knows this client is not available. ++but it is recommended so the tracker knows this client is not available. + </para> + + </section> +@@ -79,7 +79,7 @@ + <title>File Paths</title> + + <para> +-The paths of files in a Download consists of two parts, the ++The paths of files in a Download consist of two parts - the + root directory and the paths of each file. The file paths are read + from the torrent file and the files usually reside in the root + directory. The root directory is by default "./" for single file +--- a/rak/functional.h ++++ b/rak/functional.h +@@ -456,7 +456,7 @@ + + // Lightweight callback function including pointer to object. Should + // be replaced by TR1 stuff later. Requires an object to bind, instead +-// of using a seperate functor for that. ++// of using a separate functor for that. + + template <typename Ret> + class ptr_fun0 { +--- a/rak/socket_address.h ++++ b/rak/socket_address.h +@@ -93,7 +93,7 @@ + std::string address_str() const; + bool address_c_str(char* buf, socklen_t size) const; + +- // Attemts to set it as an inet, then an inet6 address. It will ++ // Attempts to set it as an inet, then an inet6 address. It will + // never set anything but net addresses, no local/unix. + bool set_address_str(const std::string& a) { return set_address_c_str(a.c_str()); } + bool set_address_c_str(const char* a); +@@ -145,7 +145,7 @@ + }; + }; + +-// Remeber to set the AF_INET. ++// Remember to set the AF_INET. + + class socket_address_inet { + public: +--- a/src/data/chunk_list.cc ++++ b/src/data/chunk_list.cc +@@ -102,7 +102,7 @@ + ChunkList::clear() { + LT_LOG_THIS(INFO, "Clearing.", 0); + +- // Don't do any sync'ing as whomever decided to shut down really ++ // Don't do any sync'ing as whoever decided to shut down really + // doesn't care, so just de-reference all chunks in queue. + for (Queue::iterator itr = m_queue.begin(), last = m_queue.end(); itr != last; ++itr) { + if ((*itr)->references() != 1 || (*itr)->writable() != 1) +@@ -200,7 +200,7 @@ + + // The chunks in 'm_queue' have been modified and need to be synced + // when appropriate. Hopefully keeping the chunks mmap'ed for a while +-// will allow us to schedule writes at more resonable intervals. ++// will allow us to schedule writes at more reasonable intervals. + + void + ChunkList::release(ChunkHandle* handle, int release_flags) { +@@ -296,7 +296,7 @@ + split = std::stable_partition(m_queue.begin(), m_queue.end(), rak::not_equal(1, std::mem_fun(&ChunkListNode::writable))); + + // Allow a flag that does more culling, so that we only get large +- // continous sections. ++ // continuous sections. + // + // How does this interact with timers, should be make it so that + // only areas with timers are (preferably) synced? +@@ -385,7 +385,7 @@ + } + + // Using a rather simple algorithm for now. This should really be more +-// robust against holes withing otherwise compact ranges and take into ++// robust against holes within otherwise compact ranges and take into + // consideration chunk size. + inline ChunkList::Queue::iterator + ChunkList::seek_range(Queue::iterator first, Queue::iterator last) { +--- a/src/data/socket_file.cc ++++ b/src/data/socket_file.cc +@@ -142,7 +142,7 @@ + + // Use workaround to resize files on vfat. It causes the whole + // client to block while it is resizing the files, this really +- // should be in a seperate thread. ++ // should be in a separate thread. + if (size != 0 && + lseek(m_fd, size - 1, SEEK_SET) == (off_t)(size - 1) && + write(m_fd, &size, 1) == 1) +--- a/src/download/chunk_statistics.h ++++ b/src/download/chunk_statistics.h +@@ -67,7 +67,7 @@ + size_type complete() const { return m_complete; } + //size_type incomplete() const; + +- // Number of non-complete peers whom's bitfield is added to the ++ // Number of non-complete peers whose bitfield is added to the + // statistics. + size_type accounted() const { return m_accounted; } + +@@ -76,15 +76,15 @@ + + // When a peer connects and sends a non-empty bitfield and is not a + // seeder, we can be fairly sure it won't just disconnect +- // immediately. Thus it should be resonable to possibly spend the +- // effort adding it to the statistics if nessesary. ++ // immediately. Thus it should be reasonable to possibly spend the ++ // effort adding it to the statistics if necessary. + + // Where do we decide on policy? On whetever we count the chunks, + // the type of connection shouldn't matter? As f.ex PCSeed will only + // make sense when seeding, it won't be counted. + + // Might want to prefer to add peers we are interested in, but which +- // arn't in us. ++ // aren't in us. + + void received_connect(PeerChunks* pc); + void received_disconnect(PeerChunks* pc); +--- a/src/torrent/data/block.h ++++ b/src/torrent/data/block.h +@@ -86,7 +86,7 @@ + const transfer_list_type* queued() const { return &m_queued; } + const transfer_list_type* transfers() const { return &m_transfers; } + +- // The leading transfer, whom's data we're currently using. ++ // The leading transfer, whose data we're currently using. + BlockTransfer* leader() { return m_leader; } + const BlockTransfer* leader() const { return m_leader; } + +@@ -121,7 +121,7 @@ + + static void create_dummy(BlockTransfer* transfer, PeerInfo* peerInfo, const Piece& piece); + +- // If the queued or transfering is already removed from the block it ++ // If the queued or transferring is already removed from the block it + // will just delete the object. Made static so it can be called when + // block == NULL. + static void release(BlockTransfer* transfer); +--- a/src/torrent/data/transfer_list.cc ++++ b/src/torrent/data/transfer_list.cc +@@ -96,7 +96,7 @@ + return base_type::insert(end(), blockList); + } + +-// TODO: Create a destructor to ensure all blocklists have been cleared/invaldiated? ++// TODO: Create a destructor to ensure all blocklists have been cleared/invalidated? + + TransferList::iterator + TransferList::erase(iterator itr) { +@@ -179,7 +179,7 @@ + + m_failedCount++; + +- // Could propably also check promoted against size of the block ++ // Could probably also check promoted against size of the block + // list. + + if ((*blockListItr)->attempt() == 0) { +@@ -197,7 +197,7 @@ + } + } + +- // Should we check if there's any peers whom have sent us bad data ++ // Should we check if there's any peers who have sent us bad data + // before, and just clear those first? + + // Re-download the blocks. +--- a/src/download/download_main.h ++++ b/src/download/download_main.h +@@ -125,7 +125,7 @@ + + void set_metadata_size(size_t s); + +- // Carefull with these. ++ // Careful with these. + void setup_delegator(); + void setup_tracker(); + +--- a/src/download/download_wrapper.cc ++++ b/src/download/download_wrapper.cc +@@ -119,7 +119,7 @@ + + m_main->slot_hash_check_add(rak::make_mem_fun(this, &DownloadWrapper::check_chunk_hash)); + +- // Info hash must be calculate from here on. ++ // Info hash must be calculated from here on. + m_hashChecker = new HashTorrent(m_main->chunk_list()); + + // Connect various signals and slots. +@@ -367,7 +367,7 @@ + // HashQueue, Delegator etc shouldn't be cleaned up at this + // point. + // +- // This needs to be seperated into a new function. ++ // This needs to be separated into a new function. + if (!m_main->delay_download_done().is_queued()) + priority_queue_insert(&taskScheduler, &m_main->delay_download_done(), cachedTime); + +--- a/src/net/socket_datagram.h ++++ b/src/net/socket_datagram.h +@@ -44,7 +44,7 @@ + class SocketDatagram : public SocketBase { + public: + +- // TODO: Make two seperate functions depending on whetever sa is ++ // TODO: Make two separate functions depending on whatever sa is + // used. + int read_datagram(void* buffer, unsigned int length, rak::socket_address* sa = NULL); + int write_datagram(const void* buffer, unsigned int length, rak::socket_address* sa = NULL); +--- a/src/protocol/handshake.h ++++ b/src/protocol/handshake.h +@@ -142,7 +142,7 @@ + + bool fill_read_buffer(int size); + +- // Check what is unnessesary. ++ // Check what is unnecessary. + bool read_proxy_connect(); + bool read_encryption_key(); + bool read_encryption_sync(); +--- a/src/protocol/peer_connection_base.cc ++++ b/src/protocol/peer_connection_base.cc +@@ -650,7 +650,7 @@ + // the block to simplify the rest of the function. + length = std::min(length, transfer->piece().length() - transfer->position()); + +- // Hmm, this might result in more bytes than nessesary being ++ // Hmm, this might result in more bytes than necessary being + // counted. + m_down->throttle()->node_used(m_peerChunks.download_throttle(), length); + m_download->info()->mutable_down_rate()->insert(length); +@@ -739,7 +739,7 @@ + return quota; + + // Also, consider checking here if the number of bytes remaining in +- // the buffer is small enought that the cost of moving them would ++ // the buffer is small enough that the cost of moving them would + // outweigh the extra context switches, etc. + + if (m_encryptBuffer->remaining() == 0) { +@@ -803,7 +803,7 @@ + m_download->info()->mutable_up_rate()->insert(bytesTransfered); + + // Just modifying the piece to cover the remaining data ends up +- // being much cleaner and we avoid an unnessesary position variable. ++ // being much cleaner and we avoid an unnecessary position variable. + m_upPiece.set_offset(m_upPiece.offset() + bytesTransfered); + m_upPiece.set_length(m_upPiece.length() - bytesTransfered); + +@@ -937,7 +937,7 @@ + } + + // High stall count peers should request if we're *not* in endgame, or +-// if we're in endgame and the download is too slow. Prefere not to request ++// if we're in endgame and the download is too slow. Prefer not to request + // from high stall counts when we are doing decent speeds. + bool + PeerConnectionBase::should_request() { +--- a/src/protocol/peer_connection_leech.cc ++++ b/src/protocol/peer_connection_leech.cc +@@ -142,7 +142,7 @@ + // Stall pieces when more than one receive_keepalive() has been + // called while a single piece is downloading. + // +- // m_downStall is decremented for every successfull download, so it ++ // m_downStall is decremented for every successful download, so it + // should stay at zero or one when downloading at an acceptable + // speed. Thus only when m_downStall >= 2 is the download actually + // stalling. +@@ -218,7 +218,7 @@ + // Cancel before dequeueing so receive_download_choke knows if it + // should remove us from throttle. + // +- // Hmm... that won't work, as we arn't necessarily unchoked when ++ // Hmm... that won't work, as we aren't necessarily unchoked when + // in throttle. + + // Which needs to be done before, and which after calling choke +@@ -357,7 +357,7 @@ + throw communication_error("Received unsupported message type."); + } + +- // We were unsuccessfull in reading the message, need more data. ++ // We were unsuccessful in reading the message, need more data. + buf->set_position_itr(beginning); + return false; + } +@@ -369,8 +369,8 @@ + + // Need to make sure ProtocolBuffer::end() is pointing to the end of + // the unread data, and that the unread data starts from the +- // beginning of the buffer. Or do we use position? Propably best, +- // therefor ProtocolBuffer::position() points to the beginning of ++ // beginning of the buffer. Or do we use position? Probably best, ++ // therefore ProtocolBuffer::position() points to the beginning of + // the unused data. + + try { +--- a/src/protocol/peer_connection_metadata.cc ++++ b/src/protocol/peer_connection_metadata.cc +@@ -209,7 +209,7 @@ + throw communication_error("Received unsupported message type."); + } + +- // We were unsuccessfull in reading the message, need more data. ++ // We were unsuccessful in reading the message, need more data. + buf->set_position_itr(beginning); + return false; + } +@@ -220,8 +220,8 @@ + + // Need to make sure ProtocolBuffer::end() is pointing to the end of + // the unread data, and that the unread data starts from the +- // beginning of the buffer. Or do we use position? Propably best, +- // therefor ProtocolBuffer::position() points to the beginning of ++ // beginning of the buffer. Or do we use position? Probably best, ++ // therefore ProtocolBuffer::position() points to the beginning of + // the unused data. + + try { +@@ -446,7 +446,7 @@ + + // DEBUG: + if (m_extensions->request_metadata_piece(p)) { +- LT_LOG_METADATA_EVENTS("request metadata piece succeded", 0); ++ LT_LOG_METADATA_EVENTS("request metadata piece succeeded", 0); + return true; + } else { + LT_LOG_METADATA_EVENTS("request metadata piece failed", 0); +--- a/src/torrent/data/file_list.cc ++++ b/src/torrent/data/file_list.cc +@@ -193,7 +193,7 @@ + m_maxFileSize = size; + } + +-// This function should really ensure that we arn't dealing files ++// This function should really ensure that we aren't dealing files + // spread over multiple mount-points. + uint64_t + FileList::free_diskspace() const { +--- a/src/torrent/download.h ++++ b/src/torrent/download.h +@@ -52,7 +52,7 @@ + class download_data; + class TrackerController; + +-// Download is safe to copy and destory as it is just a pointer to an ++// Download is safe to copy and destroy as it is just a pointer to an + // internal class. + + class LIBTORRENT_EXPORT Download { +@@ -124,7 +124,7 @@ + void set_chunks_done(uint32_t chunks_done, uint32_t chunks_wanted); + + // Use the below to set the resume data and what chunk ranges need +- // to be hash checked. If they arn't called then by default it will ++ // to be hash checked. If they aren't called then by default it will + // use an cleared bitfield and check the whole range. + // + // These must be called when is_open, !is_checked and !is_checking. +--- a/src/torrent/chunk_manager.cc ++++ b/src/torrent/chunk_manager.cc +@@ -68,7 +68,7 @@ + m_lastFreed(0) { + + // 1/5 of the available memory should be enough for the client. If +- // the client really requires alot more memory it should call this ++ // the client really requires a lot more memory, it should call this + // itself. + m_maxMemoryUsage = (estimate_max_memory_usage() * 4) / 5; + } +--- a/src/torrent/chunk_manager.h ++++ b/src/torrent/chunk_manager.h +@@ -34,7 +34,7 @@ + // Skomakerveien 33 + // 3185 Skoppum, NORWAY + +-// Add some helpfull words here. ++// Add some helpful words here. + + #ifndef LIBTORRENT_CHUNK_MANAGER_H + #define LIBTORRENT_CHUNK_MANAGER_H +@@ -86,7 +86,7 @@ + + // Set the interval to wait after the last write to a chunk before + // trying to sync it. By not forcing a sync too early it should give +- // the kernel an oppertunity to sync at its convenience. ++ // the kernel an opportunity to sync at its convenience. + uint32_t timeout_sync() const { return m_timeoutSync; } + void set_timeout_sync(uint32_t seconds) { m_timeoutSync = seconds; } + +@@ -115,7 +115,7 @@ + + // The client may use these functions to affect the library's memory + // usage by indicating how much it uses. This shouldn't really be +- // nessesary unless the client maps large amounts of memory. ++ // necessary unless the client maps large amounts of memory. + // + // If the caller finds out the allocated memory quota isn't needed + // due to e.g. other errors then 'deallocate_unused' must be called +@@ -134,7 +134,7 @@ + + void periodic_sync(); + +- // Not sure if I wnt these here. Consider implementing a generic ++ // Not sure if I want these here. Consider implementing a generic + // statistics API. + uint32_t stats_preloaded() const { return m_statsPreloaded; } + void inc_stats_preloaded() { m_statsPreloaded++; } +--- a/src/torrent/connection_manager.h ++++ b/src/torrent/connection_manager.h +@@ -34,7 +34,7 @@ + // Skomakerveien 33 + // 3185 Skoppum, NORWAY + +-// Add some helpfull words here. (These are some words, hope they are ++// Add some helpful words here. (These are some words, hope they are + // helpful) + + #ifndef LIBTORRENT_CONNECTION_MANAGER_H +--- a/rak/partial_queue.h ++++ b/rak/partial_queue.h +@@ -70,7 +70,7 @@ + // check how full we are in the lower parts so the caller knows when + // he can stop searching. + // +- // Though propably not needed, as we must continue til the first ++ // Though probably not needed, as we must continue till the first + // layer is full. + + size_type max_size() const { return m_maxLayerSize * num_layers; } +--- a/src/download/chunk_selector.cc ++++ b/src/download/chunk_selector.cc +@@ -192,7 +192,7 @@ + m_position = index; + } + +-// This could propably be split into two functions, one for checking ++// This could probably be split into two functions, one for checking + // if it shoul insert into the request_list(), and the other + // whetever we are interested in the new piece. + // +@@ -229,7 +229,7 @@ + return true; + } + +-// Could propably add another argument for max seen or something, this ++// Could probably add another argument for max seen or something, this + // would be used to find better chunks to request. + inline bool + ChunkSelector::search_linear_range(const Bitfield* bf, rak::partial_queue* pq, uint32_t first, uint32_t last) { +--- a/src/download/chunk_selector.h ++++ b/src/download/chunk_selector.h +@@ -86,7 +86,7 @@ + bool is_wanted(uint32_t index) const; + + // Call this to set the index as being downloaded, finished etc, +- // thus ignored. Propably should find a better name for this. ++ // thus ignored. Probably should find a better name for this. + void using_index(uint32_t index); + void not_using_index(uint32_t index); + +--- a/src/download/delegator.h ++++ b/src/download/delegator.h +@@ -87,7 +87,7 @@ + + bool m_aggressive; + +- // Propably should add a m_slotChunkStart thing, which will take ++ // Probably should add a m_slotChunkStart thing, which will take + // care of enabling etc, and will be possible to listen to. + slot_peer_chunk m_slot_chunk_find; + slot_size m_slot_chunk_size; +--- a/src/net/socket_set.h ++++ b/src/net/socket_set.h +@@ -51,7 +51,7 @@ + // instances. 'm_table' is a vector with the size 'openMax', each + // element of which points to an active instance in the Base vector. + +-// Propably should rename to EventSet... ++// Probably should rename to EventSet... + + class SocketSet : private std::vector<Event*, rak::cacheline_allocator<> > { + public: +--- a/src/protocol/request_list.cc ++++ b/src/protocol/request_list.cc +@@ -286,7 +286,7 @@ + goto downloading_error; + }; + +- // We received an invalid piece length, propably zero length due to ++ // We received an invalid piece length, probably zero length due to + // the peer not being able to transfer the requested piece. + // + // We need to replace the current BlockTransfer so Block can keep +--- a/src/torrent/data/block.cc ++++ b/src/torrent/data/block.cc +@@ -182,7 +182,7 @@ + + // If this block already has an active transfer, make this transfer + // skip the piece. If this transfer gets ahead of the currently +- // transfering, it will (a) take over as the leader if the data is ++ // transferring, it will (a) take over as the leader if the data is + // the same or (b) erase itself from this block if the data does not + // match. + if (m_leader != NULL) { +@@ -229,7 +229,7 @@ + + // Currently just throw out the queued transfers. In case the hash + // check fails, we might consider telling pcb during the call to +- // Block::transfering(...). But that would propably not be correct ++ // Block::transfering(...). But that would probably not be correct + // as we want to trigger cancel messages from here, as hash fail is + // a rare occurrence. + std::for_each(m_queued.begin(), m_queued.end(), std::bind1st(std::mem_fun(&Block::invalidate_transfer), this)); +@@ -358,7 +358,7 @@ + + m_notStalled -= (transfer->stall() == 0); + +- // Do the canceling magic here. ++ // Do the cancelling magic here. + if (transfer->peer_info()->connection() != NULL) + transfer->peer_info()->connection()->cancel_transfer(transfer); + } +--- a/src/torrent/download.cc ++++ b/src/torrent/download.cc +@@ -203,7 +203,7 @@ + return m_ptr->hash_checker()->start(tryQuick); + } + +-// Propably not correct, need to clear content, etc. ++// Probably not correct, need to clear content, etc. + void + Download::hash_stop() { + if (!m_ptr->hash_checker()->is_checking()) +--- a/src/torrent/utils/resume.h ++++ b/src/torrent/utils/resume.h +@@ -40,7 +40,7 @@ + // These functions use only the public interface, and thus the client + // may choose to replace these with their own resume code. + +-// Should propably move this into a sub-directory. ++// Should probably move this into a sub-directory. + + #ifndef LIBTORRENT_UTILS_RESUME_H + #define LIBTORRENT_UTILS_RESUME_H +--- a/src/torrent/dht_manager.h ++++ b/src/torrent/dht_manager.h +@@ -34,7 +34,7 @@ + // Skomakerveien 33 + // 3185 Skoppum, NORWAY + +-// Add some helpfull words here. ++// Add some helpful words here. + + #ifndef LIBTORRENT_DHT_MANAGER_H + #define LIBTORRENT_DHT_MANAGER_H +--- a/src/torrent/peer/client_list.cc ++++ b/src/torrent/peer/client_list.cc +@@ -49,7 +49,7 @@ + ClientList::ClientList() { + insert(ClientInfo::TYPE_UNKNOWN, NULL, NULL, NULL); + +- // Move this to a seperate initialize function in libtorrent. ++ // Move this to a separate initialize function in libtorrent. + + // Sorted by popularity to optimize search. This list is heavily + // biased by my own prejudices, and not at all based on facts. +@@ -215,7 +215,7 @@ + } + + } else { +- // And then the incompatible idiots that make life difficult for us ++ // And then the incompatible idiots who make life difficult for us + // others. (There's '3' schemes to choose from already...) + // + // Or not... +--- a/src/torrent/data/file.cc ++++ b/src/torrent/data/file.cc +@@ -105,13 +105,13 @@ + m_lastTouched = cachedTime.usec(); + + // Check if we got write protection and flag_resize_queued is +- // set. If so don't quit as we need to try re-sizing, instead call ++ // set. If so don't quit as we need to try resizing, instead call + // resize_file. + + if (is_open() && has_permissions(prot)) + return true; + +- // For now don't allow overridding this check in prepare. ++ // For now don't allow overriding this check in prepare. + if (m_flags & flag_create_queued) + flags |= SocketFile::o_create; + else +--- a/src/torrent/peer/connection_list.cc ++++ b/src/torrent/peer/connection_list.cc +@@ -125,7 +125,7 @@ + PeerConnectionBase* peerConnection = (*pos)->m_ptr(); + + // The connection must be erased from the list before the signal is +- // emited otherwise some listeners might do stuff with the ++ // emitted otherwise some listeners might do stuff with the + // assumption that the connection will remain in the list. + *pos = base_type::back(); + base_type::pop_back(); +@@ -165,7 +165,7 @@ + flags |= disconnect_quick; + + // Need to do it one connection at the time to ensure that when the +- // signal is emited everything is in a valid state. ++ // signal is emitted everything is in a valid state. + while (pos != end()) + erase(--end(), flags); + +--- a/src/torrent/poll_select.cc ++++ b/src/torrent/poll_select.cc +@@ -66,12 +66,12 @@ + poll_check_t(Poll* p, fd_set* s, _Operation op) : m_poll(p), m_set(s), m_op(op) {} + + bool operator () (Event* s) { +- // This check is nessesary as other events may remove a socket ++ // This check is necessary as other events may remove a socket + // from the set. + if (s == NULL) + return false; + +- // This check is not nessesary, just for debugging. ++ // This check is not necessary, just for debugging. + if (s->file_descriptor() < 0) + throw internal_error("poll_check: s->fd < 0"); + +@@ -105,7 +105,7 @@ + poll_mark(fd_set* s, unsigned int* m) : m_max(m), m_set(s) {} + + void operator () (Event* s) { +- // Neither of these checks are nessesary, just for debugging. ++ // Neither of these checks are necessary, just for debugging. + if (s == NULL) + throw internal_error("poll_mark: s == NULL"); + +--- a/src/torrent/rate.h ++++ b/src/torrent/rate.h +@@ -60,7 +60,7 @@ + // Bytes per second. + rate_type rate() const; + +- // Total bytes transfered. ++ // Total bytes transferred. + total_type total() const { return m_total; } + void set_total(total_type bytes) { m_total = bytes; } + +--- a/src/torrent/torrent.h ++++ b/src/torrent/torrent.h +@@ -85,7 +85,7 @@ + EncodingList* encoding_list() LIBTORRENT_EXPORT; + + // Will always return a valid Download. On errors it +-// throws. 'encodingList' contains a list of prefered encodings to use ++// throws. 'encodingList' contains a list of preferred encodings to use + // for file names. + // + // The Object must be on the heap allocated with 'new'. If +--- a/src/torrent/tracker_list.cc ++++ b/src/torrent/tracker_list.cc +@@ -327,7 +327,7 @@ + throw internal_error("TrackerList::receive_success(...) called but the iterator is invalid."); + + // Promote the tracker to the front of the group since it was +- // successfull. ++ // successful. + itr = promote(itr); + + l->sort(); +--- a/src/torrent/utils/thread_base.h ++++ b/src/torrent/utils/thread_base.h +@@ -206,7 +206,7 @@ + // to indicate to other threads when it is safe to change the main + // thread's event entries. + // +-// A thread should first aquire global lock, then if it needs to ++// A thread should first acquire global lock, then if it needs to + // change poll'ed sockets on the main thread it should call + // 'interrupt_main_polling' unless 'is_main_polling() == false'. + inline void +--- a/src/data/hash_torrent.cc ++++ b/src/data/hash_torrent.cc +@@ -155,7 +155,7 @@ + if (m_outstanding > 10 && m_outstanding * m_chunk_list->chunk_size() > (128 << 20)) + return; + +- // Not very efficient, but this is seldomly done. ++ // Not very efficient, but this is seldom done. + Ranges::iterator itr = m_ranges.find(m_position); + + if (itr == m_ranges.end()) { +@@ -194,7 +194,7 @@ + } + + // If the error number is not valid, then we've just encountered a +- // file that hasn't be created/resized. Which means we ignore it ++ // file that hasn't been created/resized. Which means we ignore it + // when doing initial hashing. + if (handle.error_number().is_valid() && handle.error_number().value() != rak::error_number::e_noent) { + if (handle.is_valid()) +--- a/src/torrent/object_stream.cc ++++ b/src/torrent/object_stream.cc +@@ -110,8 +110,8 @@ + return raw_string(first, length); + } + +-// Could consider making this non-recursive, but they seldomly are +-// deep enough to make that worth-while. ++// Might consider making this non-recursive, but they are seldom ++// deep enough to make that worthwhile. + void + object_read_bencode(std::istream* input, Object* object, uint32_t depth) { + int c; +@@ -144,7 +144,7 @@ + Object::list_iterator itr = object->as_list().insert(object->as_list().end(), Object()); + object_read_bencode(input, &*itr, depth); + +- // The unordered flag is inherited also from list elements who ++ // The unordered flag is inherited also from list elements which + // have been marked as unordered, though e.g. unordered strings + // in the list itself does not cause this flag to be set. + if (itr->flags() & Object::flag_unordered) +@@ -697,7 +697,7 @@ + // position... + static_map_key_search_result key_search = find_key_match(first_key, last_key, current_key); + +- // We're not interest in this object, skip it. ++ // We're not interested in this object, skip it. + if (key_search.second == 0) { + first = object_read_bencode_skip_c(first, last); + continue; +--- a/src/torrent/poll_select.h ++++ b/src/torrent/poll_select.h +@@ -46,7 +46,7 @@ + // The default Poll implementation using fd_set's. + // + // You should call torrent::perform() (or whatever the function will +-// be called) immidiately before and after the call to work(...). This ++// be called) immediately before and after the call to work(...). This + // ensures we dealt with scheduled tasks and updated the cache'ed time. + + class LIBTORRENT_EXPORT PollSelect : public Poll { +--- a/test/torrent/tracker_controller_test.cc ++++ b/test/torrent/tracker_controller_test.cc +@@ -489,7 +489,7 @@ + // disabling the timeout. + // + // The enable/disable tracker functions will poke the tracker +-// controller, ensuring the tast timeout gets re-started. ++// controller, ensuring the test timeout gets restarted. + void + tracker_controller_test::test_timeout_lacking_usable() { + TEST_MULTI3_BEGIN(); +@@ -574,7 +574,7 @@ + // trackers. e.g. check all send_tracker_itr uses. + + +-// Add test for promiscious mode while with a single tracker? ++// Add test for promiscuous mode while with a single tracker? + + + +@@ -585,7 +585,7 @@ + + // Test trying to send_start twice, etc. + +-// Test send_start promiscious... ++// Test send_start promiscuous... + // - Make sure we check that no timer is inserted while still having active trackers. + // - Calculate the next timeout according to a list of in-use trackers, with the first timeout as the interval. +
signature.asc
Description: OpenPGP digital signature