|
From: <arn...@us...> - 2007-12-11 17:07:29
|
Revision: 931
http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=931&view=rev
Author: arnetheduck
Date: 2007-12-11 09:07:20 -0800 (Tue, 11 Dec 2007)
Log Message:
-----------
fix state issues
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/dcpp/ConnectionManager.cpp
dcplusplus/trunk/dcpp/DownloadManager.cpp
dcplusplus/trunk/dcpp/UploadManager.cpp
dcplusplus/trunk/dcpp/version.h
dcplusplus/trunk/win32/DCPlusPlus.rc
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2007-12-10 22:30:37 UTC (rev 930)
+++ dcplusplus/trunk/changelog.txt 2007-12-11 17:07:20 UTC (rev 931)
@@ -26,6 +26,7 @@
* Fixed status bars (poy)
* Fixed protocol error STA being sent as type C
* Fixed a multisource download crash
+* Fixed state checks for uploads (an invalid sequence could possibly crash client from remote)
-- 0.703 2007-11-08 --
* Fixed invalid strings (thanks james ross)
Modified: dcplusplus/trunk/dcpp/ConnectionManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-10 22:30:37 UTC (rev 930)
+++ dcplusplus/trunk/dcpp/ConnectionManager.cpp 2007-12-11 17:07:20 UTC (rev 931)
@@ -323,7 +323,7 @@
void ConnectionManager::on(AdcCommand::SUP, UserConnection* aSource, const AdcCommand& cmd) throw() {
if(aSource->getState() != UserConnection::STATE_SUPNICK) {
// Already got this once, ignore...@todo fix support updates
- dcdebug("CM::onMyNick %p sent nick twice\n", (void*)aSource);
+ dcdebug("CM::onSUP %p sent sup twice\n", (void*)aSource);
return;
}
@@ -375,7 +375,7 @@
aSource->setState(UserConnection::STATE_INF);
}
-void ConnectionManager::on(AdcCommand::STA, UserConnection*, const AdcCommand&) throw() {
+void ConnectionManager::on(AdcCommand::STA, UserConnection*, const AdcCommand& cmd) throw() {
}
@@ -595,9 +595,7 @@
void ConnectionManager::on(AdcCommand::INF, UserConnection* aSource, const AdcCommand& cmd) throw() {
if(aSource->getState() != UserConnection::STATE_INF) {
- // Already got this once, ignore...
aSource->send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_GENERIC, "Expecting INF"));
- dcdebug("CM::onINF %p sent INF twice\n", (void*)aSource);
aSource->disconnect();
return;
}
Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-10 22:30:37 UTC (rev 930)
+++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-11 17:07:20 UTC (rev 931)
@@ -515,7 +515,7 @@
}
const string& err = cmd.getParameters()[0];
- if(err.length() < 3) {
+ if(err.length() != 3) {
aSource->disconnect();
return;
}
@@ -533,6 +533,10 @@
noSlots(aSource);
return;
}
+ case AdcCommand::SEV_SUCCESS:
+ // We don't know any messages that would give us these...
+ dcdebug("Unknown success message %s %s", err.c_str(), cmd.getParam(1).c_str());
+ return;
}
aSource->disconnect();
}
Modified: dcplusplus/trunk/dcpp/UploadManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/UploadManager.cpp 2007-12-10 22:30:37 UTC (rev 930)
+++ dcplusplus/trunk/dcpp/UploadManager.cpp 2007-12-11 17:07:20 UTC (rev 931)
@@ -280,6 +280,11 @@
}
void UploadManager::on(AdcCommand::GET, UserConnection* aSource, const AdcCommand& c) throw() {
+ if(aSource->getState() != UserConnection::STATE_GET) {
+ dcdebug("UM::onGET Bad state, ignoring\n");
+ return;
+ }
+
const string& type = c.getParam(0);
const string& fname = c.getParam(1);
int64_t aStartPos = Util::toInt64(c.getParam(2));
@@ -454,6 +459,11 @@
}
void UploadManager::on(AdcCommand::GFI, UserConnection* aSource, const AdcCommand& c) throw() {
+ if(aSource->getState() != UserConnection::STATE_GET) {
+ dcdebug("UM::onSend Bad state, ignoring\n");
+ return;
+ }
+
if(c.getParameters().size() < 2) {
aSource->send(AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_PROTOCOL_GENERIC, "Missing parameters"));
return;
Modified: dcplusplus/trunk/dcpp/version.h
===================================================================
--- dcplusplus/trunk/dcpp/version.h 2007-12-10 22:30:37 UTC (rev 930)
+++ dcplusplus/trunk/dcpp/version.h 2007-12-11 17:07:20 UTC (rev 931)
@@ -17,7 +17,7 @@
*/
#define APPNAME "DC++"
-#define VERSIONSTRING "0.703"
-#define VERSIONFLOAT 0.703
+#define VERSIONSTRING "0.704"
+#define VERSIONFLOAT 0.704
/* Update the .rc file as well... */
Modified: dcplusplus/trunk/win32/DCPlusPlus.rc
===================================================================
--- dcplusplus/trunk/win32/DCPlusPlus.rc 2007-12-10 22:30:37 UTC (rev 930)
+++ dcplusplus/trunk/win32/DCPlusPlus.rc 2007-12-11 17:07:20 UTC (rev 931)
@@ -818,8 +818,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,7,0,3
- PRODUCTVERSION 0,7,0,3
+ FILEVERSION 0,7,0,4
+ PRODUCTVERSION 0,7,0,4
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -836,12 +836,12 @@
BEGIN
VALUE "Comments", "http://dcplusplus.sourceforge.net"
VALUE "FileDescription", "DC++"
- VALUE "FileVersion", "0, 7, 0, 3"
+ VALUE "FileVersion", "0, 7, 0, 4"
VALUE "InternalName", "DC++"
VALUE "LegalCopyright", "Copyright 2001-2006 Jacek Sieka"
VALUE "OriginalFilename", "DCPlusPlus.exe"
VALUE "ProductName", "DC++"
- VALUE "ProductVersion", "0, 7, 0, 3"
+ VALUE "ProductVersion", "0, 7, 0, 4"
END
END
BLOCK "VarFileInfo"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|