← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3026: Parse QP in DM::noSlots and make it visible to the user

 

------------------------------------------------------------
revno: 3026
committer: iceman50 <bdcdevel@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Wed 2012-08-08 19:52:23 -0500
message:
  Parse QP in DM::noSlots and make it visible to the user
modified:
  dcpp/DownloadManager.cpp
  dcpp/DownloadManager.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/DownloadManager.cpp'
--- dcpp/DownloadManager.cpp	2012-06-22 14:46:44 +0000
+++ dcpp/DownloadManager.cpp	2012-08-09 00:52:23 +0000
@@ -346,18 +346,19 @@
 	LOG(LogManager::DOWNLOAD, params);
 }
 
-void DownloadManager::on(UserConnectionListener::MaxedOut, UserConnection* aSource) noexcept {
-	noSlots(aSource);
+void DownloadManager::on(UserConnectionListener::MaxedOut, UserConnection* aSource, string param) noexcept {
+	noSlots(aSource, param);
 }
 
-void DownloadManager::noSlots(UserConnection* aSource) {
+void DownloadManager::noSlots(UserConnection* aSource, string param) {
 	if(aSource->getState() != UserConnection::STATE_SND) {
 		dcdebug("DM::noSlots Bad state, disconnecting\n");
 		aSource->disconnect();
 		return;
 	}
 
-	failDownload(aSource, _("No slots available"));
+	string extra = param.empty() ? Util::emptyString : _(" - Queued: ") + param;
+	failDownload(aSource, _("No slots available") + extra);
 }
 
 void DownloadManager::onFailed(UserConnection* aSource, const string& aError) {
@@ -433,7 +434,8 @@
 			fileNotAvailable(aSource);
 			return;
 		case AdcCommand::ERROR_SLOTS_FULL:
-			noSlots(aSource);
+			string param;
+			noSlots(aSource, cmd.getParam("QP", 0, param) ? param : Util::emptyString);
 			return;
 		}
 	case AdcCommand::SEV_SUCCESS:

=== modified file 'dcpp/DownloadManager.h'
--- dcpp/DownloadManager.h	2012-06-22 14:46:44 +0000
+++ dcpp/DownloadManager.h	2012-08-09 00:52:23 +0000
@@ -65,7 +65,7 @@
 	void removeConnection(UserConnectionPtr aConn);
 	void removeDownload(Download* aDown);
 	void fileNotAvailable(UserConnection* aSource);
-	void noSlots(UserConnection* aSource);
+	void noSlots(UserConnection* aSource, string param = Util::emptyString);
 
 	void logDownload(UserConnection* aSource, Download* d);
 	int64_t getResumePos(const string& file, const TigerTree& tt, int64_t startPos);
@@ -88,7 +88,7 @@
 	virtual void on(Data, UserConnection*, const uint8_t*, size_t) noexcept;
 	virtual void on(Failed, UserConnection* aSource, const string& aError) noexcept { onFailed(aSource, aError); }
 	virtual void on(ProtocolError, UserConnection* aSource, const string& aError) noexcept { onFailed(aSource, aError); }
-	virtual void on(MaxedOut, UserConnection*) noexcept;
+	virtual void on(MaxedOut, UserConnection*, string param = Util::emptyString) noexcept;
 	virtual	void on(FileNotAvailable, UserConnection*) noexcept;
 
 	virtual void on(AdcCommand::SND, UserConnection*, const AdcCommand&) noexcept;