-
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
550 additions
and
704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,7 @@ | ||
// libTorrent - BitTorrent library | ||
// Copyright (C) 2005-2011, Jari Sundell | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program; if not, write to the Free Software | ||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
// | ||
// In addition, as a special exception, the copyright holders give | ||
// permission to link the code of portions of this program with the | ||
// OpenSSL library under certain conditions as described in each | ||
// individual source file, and distribute linked combinations | ||
// including the two. | ||
// | ||
// You must obey the GNU General Public License in all respects for | ||
// all of the code used other than OpenSSL. If you modify file(s) | ||
// with this exception, you may extend this exception to your version | ||
// of the file(s), but you are not obligated to do so. If you do not | ||
// wish to do so, delete this exception statement from your version. | ||
// If you delete this exception statement from all source files in the | ||
// program, then also delete it here. | ||
// | ||
// Contact: Jari Sundell <[email protected]> | ||
// | ||
// Skomakerveien 33 | ||
// 3185 Skoppum, NORWAY | ||
|
||
#include "config.h" | ||
|
||
#include <cassert> | ||
|
||
#include "torrent/exceptions.h" | ||
#include "torrent/object_stream.h" | ||
#include "tracker/tracker_dht.h" | ||
|
@@ -61,13 +27,10 @@ DhtSearch::DhtSearch(const HashString& target, const DhtBucket& contacts) | |
|
||
DhtSearch::~DhtSearch() { | ||
// Make sure transactions were destructed first. Since it is the destruction | ||
// of a transaction that triggers this destructor, that should always be the | ||
// of a transaction that triggers this destructor, that should always be the | ||
// case. | ||
if (m_pending) | ||
throw internal_error("DhtSearch::~DhtSearch called with pending transactions."); | ||
|
||
if (m_concurrency != 3) | ||
throw internal_error("DhtSearch::~DhtSearch with invalid concurrency limit."); | ||
assert(!m_pending && "DhtSearch::~DhtSearch called with pending transactions."); | ||
assert(m_concurrency == 3 && "DhtSearch::~DhtSearch called with invalid concurrency limit."); | ||
|
||
for (accessor itr = begin(); itr != end(); ++itr) | ||
delete itr.node(); | ||
|
@@ -208,12 +171,11 @@ DhtSearch::node_status(const_accessor& n, bool success) { | |
} | ||
|
||
DhtAnnounce::~DhtAnnounce() { | ||
if (!complete()) | ||
throw internal_error("DhtAnnounce::~DhtAnnounce called while announce not complete."); | ||
assert(complete() && "DhtAnnounce::~DhtAnnounce called while announce not complete."); | ||
|
||
const char* failure = NULL; | ||
|
||
if (m_tracker->get_state() != TrackerDht::state_announcing) { | ||
if (m_tracker->get_dht_state() != TrackerDht::state_announcing) { | ||
if (!m_contacted) | ||
failure = "No DHT nodes available for peer search."; | ||
else | ||
|
@@ -244,7 +206,7 @@ DhtAnnounce::start_announce() { | |
|
||
m_contacted = m_pending = size(); | ||
m_replied = 0; | ||
m_tracker->set_state(TrackerDht::state_announcing); | ||
m_tracker->set_dht_state(TrackerDht::state_announcing); | ||
|
||
for (const_accessor itr(begin()); itr != end(); ++itr) | ||
set_node_active(itr, true); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.