|
From: <arn...@us...> - 2008-02-03 16:12:28
|
Revision: 986
http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=986&view=rev
Author: arnetheduck
Date: 2008-02-03 08:11:52 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
Crash fixes
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/dcpp/DownloadManager.cpp
dcplusplus/trunk/dcpp/MerkleTree.h
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2008-02-02 23:28:26 UTC (rev 985)
+++ dcplusplus/trunk/changelog.txt 2008-02-03 16:11:52 UTC (rev 986)
@@ -19,6 +19,8 @@
* [ADC] Handle third person formatting (thanks poy)
* Fix right-click issue when chat history is long (thanks poy)
* In waiting users, show requested chunk (since we can't know % done)
+* Fixed crash when download connection was disconnected before any data was received
+* Fixed crash due to race condition on idle check (thans bigmuscle)
-- 0.704 2007-12-14 --
* Hub lists added to utilize Coral's distributed network (ullner)
Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-02 23:28:26 UTC (rev 985)
+++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-03 16:11:52 UTC (rev 986)
@@ -471,6 +471,12 @@
}
void DownloadManager::failDownload(UserConnection* aSource, const string& reason) {
+
+ {
+ Lock l(cs);
+ idlers.erase(remove(idlers.begin(), idlers.end(), aSource), idlers.end());
+ }
+
Download* d = aSource->getDownload();
if(d) {
@@ -479,7 +485,10 @@
QueueManager::getInstance()->putDownload(d, false);
}
- removeConnection(aSource);
+
+ dcassert(aSource->getDownload() == NULL);
+ aSource->removeListener(this);
+ aSource->disconnect();
}
void DownloadManager::removeDownload(Download* d) {
Modified: dcplusplus/trunk/dcpp/MerkleTree.h
===================================================================
--- dcplusplus/trunk/dcpp/MerkleTree.h 2008-02-02 23:28:26 UTC (rev 985)
+++ dcplusplus/trunk/dcpp/MerkleTree.h 2008-02-03 16:11:52 UTC (rev 986)
@@ -114,6 +114,10 @@
}
uint8_t* finalize() {
+ // No updates yet, make sure we have at least one leaf for 0-length files...
+ if(leaves.empty() && blocks.empty()) {
+ update(0, 0);
+ }
while(blocks.size() > 1) {
MerkleBlock& a = blocks[blocks.size()-2];
MerkleBlock& b = blocks[blocks.size()-1];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|