← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2637: ZLIF support

 

------------------------------------------------------------
revno: 2637
fixes bug: https://launchpad.net/bugs/783516
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Sat 2011-10-15 23:59:13 +0900
message:
  ZLIF support
modified:
  changelog.txt
  dcpp/AdcCommand.h
  dcpp/AdcHub.cpp
  dcpp/AdcHub.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 'changelog.txt'
--- changelog.txt	2011-10-06 18:58:07 +0000
+++ changelog.txt	2011-10-15 14:59:13 +0000
@@ -45,6 +45,8 @@
 * Switch to binary GeoIP databases, add the IPv6 one (poy)
 * The country format can be customized, see help for available codes (poy)
 * Handle GeoIP database updates from within the program (iceman50, poy)
+* [L#783516] ZLIF compression support (iceman50)
+
 
 -- 0.782 2011-03-05 --
 * Prevent a remote crash triggered via malformed user commands (poy)

=== modified file 'dcpp/AdcCommand.h'
--- dcpp/AdcCommand.h	2011-03-29 20:40:28 +0000
+++ dcpp/AdcCommand.h	2011-10-15 14:59:13 +0000
@@ -109,6 +109,8 @@
 	C(CMD, 'C','M','D');
 	C(NAT, 'N','A','T');
 	C(RNT, 'R','N','T');
+	C(ZON, 'Z','O','N');
+	C(ZOF, 'Z','O','F');
 #undef C
 
 	static const uint32_t HUB_SID = 0xffffffff;		// No client will have this sid
@@ -206,6 +208,8 @@
 				C(CMD);
 				C(NAT);
 				C(RNT);
+				C(ZON);
+				C(ZOF);
 			default:
 				dcdebug("Unknown ADC command: %.50s\n", aLine.c_str());
 				break;

=== modified file 'dcpp/AdcHub.cpp'
--- dcpp/AdcHub.cpp	2011-09-30 11:33:12 +0000
+++ dcpp/AdcHub.cpp	2011-10-15 14:59:13 +0000
@@ -57,6 +57,7 @@
 const string AdcHub::TIGR_SUPPORT("ADTIGR");
 const string AdcHub::UCM0_SUPPORT("ADUCM0");
 const string AdcHub::BLO0_SUPPORT("ADBLO0");
+const string AdcHub::ZLIF_SUPPORT("ADZLIF");
 
 const vector<StringList> AdcHub::searchExts;
 
@@ -635,6 +636,22 @@
 	ConnectionManager::getInstance()->adcConnect(*u, port, Util::toString(sock->getLocalPort()), BufferedSocket::NAT_SERVER, token, secure);
 }
 
+void AdcHub::handle(AdcCommand::ZON, AdcCommand& c) noexcept {
+	try {
+			sock->setMode(BufferedSocket::MODE_ZPIPE);
+		} catch (const Exception& e) {
+			dcdebug("AdcHub::handleZON failed with error: %s\n", e.getError().c_str());
+		}
+}
+
+void AdcHub::handle(AdcCommand::ZOF, AdcCommand& c) noexcept {
+	try {
+			sock->setMode(BufferedSocket::MODE_LINE);
+		} catch (const Exception& e) {
+			dcdebug("AdcHub::handleZOF failed with error: %s\n", e.getError().c_str());
+		}
+}
+
 void AdcHub::connect(const OnlineUser& user, const string& token) {
 	connect(user, token, CryptoManager::getInstance()->TLSOk() && user.getUser()->isSet(User::TLS));
 }
@@ -1070,6 +1087,9 @@
 	if(BOOLSETTING(SEND_BLOOM)) {
 		cmd.addParam(BLO0_SUPPORT);
 	}
+	
+	cmd.addParam(ZLIF_SUPPORT);
+	
 	send(cmd);
 }
 

=== modified file 'dcpp/AdcHub.h'
--- dcpp/AdcHub.h	2011-09-30 11:33:12 +0000
+++ dcpp/AdcHub.h	2011-10-15 14:59:13 +0000
@@ -69,6 +69,7 @@
 	static const string TIGR_SUPPORT;
 	static const string UCM0_SUPPORT;
 	static const string BLO0_SUPPORT;
+	static const string ZLIF_SUPPORT;
 
 private:
 	friend class ClientManager;
@@ -122,6 +123,8 @@
 	void handle(AdcCommand::GET, AdcCommand& c) noexcept;
 	void handle(AdcCommand::NAT, AdcCommand& c) noexcept;
 	void handle(AdcCommand::RNT, AdcCommand& c) noexcept;
+	void handle(AdcCommand::ZON, AdcCommand& c) noexcept;
+	void handle(AdcCommand::ZOF, AdcCommand& c) noexcept;
 
 	template<typename T> void handle(T, AdcCommand&) { }