| Summary: | when importing torrent and start seeding (without first downloading some chunks)-> event=completed | ||
|---|---|---|---|
| Product: | [Applications] ktorrent | Reporter: | Martijn van Vliet <mandraakje> |
| Component: | general | Assignee: | Joris Guisson <joris.guisson> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Martijn van Vliet
2006-08-08 16:49:00 UTC
Above is when opening a torrent and you point a location where it already find the right files. Starting download Pre-allocating diskspace Preallocating file /home/Martijn/.kde/share/apps/ktorrent/tor17/cache (3657142272 bytes) file_size = 3657142272 PreallocationThread has finished Doing tracker request to url : http://torrent.ubuntu.com:6969/announce?peer_id=-KT20DV-442558556447&port=48153&uploaded=0&downloaded=0&left=0&compact=1&numwant=100&key=1305821864&event=started&info_hash=%adS%c9%24%e2N%a8%b2%2c%7f%a4%feb%0fGuN%20%110 Doing tracker request to url : http://torrent.ubuntu.com:6969/announce?peer_id=-KT20DV-442558556447&port=48153&uploaded=0&downloaded=0&left=0&compact=1&numwant=100&key=1305821864&event=completed&info_hash=%adS%c9%24%e2N%a8%b2%2c%7f%a4%feb%0fGuN%20%110 Torrent moved to SeedView. The import plugin handles this the correct way with only event=started and left=0. You are correct, allthough I'm not quite sure, if this is against the protocol. I think it implies we did 0 -> 100% without any seeders in less than one second. This is not true off course. The trackers also counts this as way of event as one snatch. (this was why i noticed in the first place) I wasn't sure mself so i asked on #bittorrent before reporting, and another guy said it should be event=started. We will make sure the completed does not happen. SVN commit 585108 by guisson:
Changes :
- Only send completed to tracker when we have all chunks
- When auto importing do not send completed when downloaded data is fully there
BUG: 132066
M +15 -15 ktorrent.kdevelop
M +12 -0 libktorrent/torrent/chunkmanager.cpp
M +7 -0 libktorrent/torrent/chunkmanager.h
M +5 -1 libktorrent/torrent/torrentcontrol.cpp
--- trunk/extragear/network/ktorrent/ktorrent.kdevelop #585107:585108
@@ -14,7 +14,7 @@
</keywords>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
- <description/>
+ <description></description>
<ignoreparts/>
<versioncontrol>kdevsubversion</versioncontrol>
</general>
@@ -69,14 +69,14 @@
<f77compiler>kdevg77options</f77compiler>
<cxxflags>-O0 -g3</cxxflags>
<envvars/>
- <topsourcedir/>
- <cppflags/>
- <ldflags/>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
- <cflags/>
- <f77flags/>
+ <topsourcedir></topsourcedir>
+ <cppflags></cppflags>
+ <ldflags></ldflags>
+ <ccompilerbinary></ccompilerbinary>
+ <cxxcompilerbinary></cxxcompilerbinary>
+ <f77compilerbinary></f77compilerbinary>
+ <cflags></cflags>
+ <f77flags></f77flags>
</debug>
</configurations>
<subclassing>
@@ -150,14 +150,14 @@
<general>
<dbgshell>libtool</dbgshell>
<programargs>--nofork --debug</programargs>
- <gdbpath/>
+ <gdbpath></gdbpath>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
<runappinappdirectory>true</runappinappdirectory>
- <configGdbScript/>
- <runShellScript/>
- <runGdbScript/>
+ <configGdbScript></configGdbScript>
+ <runShellScript></runShellScript>
+ <runGdbScript></runGdbScript>
</general>
<display>
<staticmembers>false</staticmembers>
@@ -232,7 +232,7 @@
<headerCompletionDelay>250</headerCompletionDelay>
</codecompletion>
<creategettersetter>
- <prefixGet/>
+ <prefixGet></prefixGet>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
@@ -245,7 +245,7 @@
<qt>
<used>true</used>
<version>3</version>
- <root/>
+ <root></root>
</qt>
</kdevcppsupport>
<kdevvisualadvance>
--- trunk/extragear/network/ktorrent/libktorrent/torrent/chunkmanager.cpp #585107:585108
@@ -410,6 +410,18 @@
recalc_chunks_left = false;
return num;
}
+
+ bool ChunkManager::haveAllChunks() const
+ {
+ Uint32 tot = chunks.size();
+ for (Uint32 i = 0;i < tot;i++)
+ {
+ const Chunk* c = chunks[i];
+ if (!bitset.get(i))
+ return false;
+ }
+ return true;
+ }
Uint64 ChunkManager::bytesExcluded() const
{
--- trunk/extragear/network/ktorrent/libktorrent/torrent/chunkmanager.h #585107:585108
@@ -190,6 +190,13 @@
* @return The number of chunks to download
*/
Uint32 chunksLeft() const;
+
+ /**
+ * Check if we have all chunks, this is not the same as
+ * chunksLeft() == 0, it does not look at excluded chunks.
+ * @return true if all chunks have been downloaded
+ */
+ bool haveAllChunks() const;
/**
* Get the number of chunks which have been excluded.
--- trunk/extragear/network/ktorrent/libktorrent/torrent/torrentcontrol.cpp #585107:585108
@@ -176,7 +176,9 @@
if (stats.completed && !comp)
{
// download has just been completed
- psman->completed();
+ // only sent completed to tracker when we have all chunks (so no excluded chunks)
+ if (cman->haveAllChunks())
+ psman->completed();
pman->killSeeders();
QDateTime now = QDateTime::currentDateTime();
running_time_dl += time_started_dl.secsTo(now);
@@ -1178,6 +1180,8 @@
{
down->recalcDownloaded();
stats.imported_bytes = down->bytesDownloaded();
+ if (cman->haveAllChunks())
+ stats.completed = true;
}
}
delete dc;
|