← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3383: rework the fix for #1245179

 

------------------------------------------------------------
revno: 3383
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2013-12-10 22:01:59 +0100
message:
  rework the fix for #1245179
modified:
  changelog.txt
  dcpp/Socket.cpp


--
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	2013-12-09 23:12:01 +0000
+++ changelog.txt	2013-12-10 21:01:59 +0000
@@ -7,7 +7,7 @@
 * [L#210217] Add connectivity status for hubs to the favorite hubs window (ullner)
 * [L#593613] Added /lastmessage in PMs to show the time of the last message (ullner)
 * [L#363092] Disallow transfer port and encrypted transfer port to be the same (ullner)
-* [L#1245179] Correct connecting to IPv6 addresses (maksis)
+* [L#1245179] Avoid connection failures (maksis)
 
 -- 0.831 2013-11-11 --
 * [L#1249810] Fix NMDC TTH search responses (emtee)

=== modified file 'dcpp/Socket.cpp'
--- dcpp/Socket.cpp	2013-12-09 23:12:01 +0000
+++ dcpp/Socket.cpp	2013-12-10 21:01:59 +0000
@@ -345,6 +345,7 @@
 	auto addr = resolveAddr(aAddr, aPort);
 
 	string lastError;
+
 	for(auto ai = addr.get(); ai; ai = ai->ai_next) {
 		if((ai->ai_family == AF_INET && !sock4.valid()) ||
 			(ai->ai_family == AF_INET6 && !sock6.valid() && !v4only))
@@ -360,6 +361,8 @@
 
 				check([&] { return ::connect(sock, ai->ai_addr, ai->ai_addrlen); }, true);
 				setIp(resolveName(ai->ai_addr, ai->ai_addrlen));
+				return;
+
 			} catch(const SocketException& e) {
 				ai->ai_family == AF_INET ? sock4.reset() : sock6.reset();
 				lastError = e.getError();
@@ -367,8 +370,7 @@
 		}
 	}
 
-	if(!lastError.empty())
-		throw SocketException(lastError);
+	throw SocketException(lastError);
 }
 
 namespace {