Skip to content

Commit 226ee6b

Browse files
committed
* Fixed a bug that cause the hash checker not to start.
* Added "base_path" and "base_filename" types to the "create/delete_link" command. git-svn-id: svn://rakshasa.no/libtorrent/trunk/libtorrent@851 e378c898-3ddf-0310-93e7-cc216c733640
1 parent 14346c9 commit 226ee6b

File tree

3 files changed

+9
-45
lines changed

3 files changed

+9
-45
lines changed

TODO_LONGTERM

-26
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,6 @@ not open. Or do session torrent saving as needed, when seeding is
4343
stopped etc. Perhaps a dirty flag.
4444

4545

46-
== Global and Download specific variables ==
47-
48-
There are various things, ties to files, peer connection type etc that
49-
should be in a generic variable container thingie. In addition there
50-
should be a template for new downloads, download factory etc. The
51-
download factory's being given to the new download.
52-
53-
Remember that we currently don't save sessions for inactive torrents.
54-
55-
Some variables should have custom store/retrive slots. One kind could
56-
be used to store/retrive values from the bencoded data, with syntax
57-
like "rtorrent/state" etc.
58-
59-
Stuff about new bencode thingie.
60-
61-
Make it possible to do an validity check on a bencode stream.
62-
63-
64-
== Cleanup of the display manager ==
65-
66-
Consider taking the tasks out of the Window class, and just use flags
67-
for those that want to be regulary updated.
68-
69-
Get rid of the Element* classes?
70-
71-
7246
== Configurable keybindings ==
7347

7448
...

src/data/hash_torrent.cc

+6-16
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,10 @@ HashTorrent::start(bool tryQuick) {
5858
if (m_position == m_chunkList->size())
5959
return true;
6060

61-
if (!is_checking()) {
62-
if (m_position > 0 || m_chunkList->empty())
63-
throw internal_error("HashTorrent::start() call failed.");
61+
if (m_position > 0 || m_chunkList->empty())
62+
throw internal_error("HashTorrent::start() call failed.");
6463

65-
m_outstanding = 0;
66-
}
67-
68-
// This doesn't really handle paused hashing properly... Do we set
69-
// m_outstanding to -1 when stopping?
64+
m_outstanding = 0;
7065

7166
queue(tryQuick);
7267
return m_position == m_chunkList->size();
@@ -100,22 +95,17 @@ HashTorrent::confirm_checked() {
10095

10196
void
10297
HashTorrent::receive_chunkdone() {
103-
if (m_outstanding == -1)
104-
throw internal_error("HashTorrent::receive_chunkdone() m_outstanding < 0.");
98+
if (m_outstanding <= 0)
99+
throw internal_error("HashTorrent::receive_chunkdone() m_outstanding <= 0.");
105100

106101
// m_signalChunk will always point to
107102
// DownloadMain::receive_hash_done, so it will take care of cleanup.
108103
//
109104
// Make sure we call chunkdone before torrentDone has a chance to
110105
// trigger.
111-
// m_slotChunkDone(handle, hash);
112106
m_outstanding--;
113107

114-
// Don't add more when we've stopped. Use some better condition than
115-
// m_outstanding. This code is ugly... needs a refactoring, a
116-
// seperate flag for active and allow pause or clearing the state.
117-
if (m_outstanding >= 0)
118-
queue(false);
108+
queue(false);
119109
}
120110

121111
// Mark unsuccessful checks so that if we have just stopped the

src/torrent/download.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,19 @@ Download::stop() {
119119
bool
120120
Download::hash_check(bool tryQuick) {
121121
if (m_ptr->hash_checker()->is_checking())
122-
return m_ptr->hash_checker()->start(tryQuick);
122+
throw internal_error("Download::hash_check(...) called but the hash is already being checked.");
123123

124124
if (!m_ptr->info()->is_open() || m_ptr->info()->is_active())
125125
throw internal_error("Download::hash_check(...) called on a closed or active download.");
126126

127127
if (m_ptr->hash_checker()->is_checked())
128128
throw internal_error("Download::hash_check(...) called but already hash checked.");
129129

130-
// The bitfield still hasn't been allocated, so no resume data was
131-
// given.
132130
Bitfield* bitfield = m_ptr->main()->file_list()->mutable_bitfield();
133131

134132
if (bitfield->empty()) {
133+
// The bitfield still hasn't been allocated, so no resume data was
134+
// given.
135135
bitfield->allocate();
136136
bitfield->unset_all();
137137

0 commit comments

Comments
 (0)