← Back to team overview

linuxdcpp-team team mailing list archive

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

 

------------------------------------------------------------
revno: 3384
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2013-12-10 22:32:00 +0100
message:
  rework the fix for #1245179
modified:
  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 'dcpp/Socket.cpp'
--- dcpp/Socket.cpp	2013-12-10 21:01:59 +0000
+++ dcpp/Socket.cpp	2013-12-10 21:32:00 +0000
@@ -361,7 +361,6 @@
 
 				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();
@@ -370,7 +369,10 @@
 		}
 	}
 
-	throw SocketException(lastError);
+	// An IP should be set if at least one connection attempt succeeded
+	if(!ip.empty()) {
+		throw SocketException(lastError);
+	}
 }
 
 namespace {