← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2608: socket fix for Win 8: call setsockopt before connecting

 

------------------------------------------------------------
revno: 2608
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2011-09-21 19:51:13 +0200
message:
  socket fix for Win 8: call setsockopt before connecting
modified:
  dcpp/BufferedSocket.cpp
  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/BufferedSocket.cpp'
--- dcpp/BufferedSocket.cpp	2011-09-04 15:20:46 +0000
+++ dcpp/BufferedSocket.cpp	2011-09-21 17:51:13 +0000
@@ -130,13 +130,15 @@
 	while (GET_TICK() < endTime) {
 		dcdebug("threadConnect attempt %s %s:%s\n", localPort.c_str(), aAddr.c_str(), aPort.c_str());
 		try {
+
+			setOptions();
+
 			if(proxy) {
 				sock->socksConnect(aAddr, aPort, LONG_TIMEOUT);
 			} else {
 				sock->connect(aAddr, aPort, localPort);
 			}
 
-			setOptions();
 			bool connSucceeded;
 			while(!(connSucceeded = sock->waitConnected(POLL_TIMEOUT)) && endTime >= GET_TICK()) {
 				if(disconnecting) return;

=== modified file 'dcpp/Socket.cpp'
--- dcpp/Socket.cpp	2011-09-04 15:20:46 +0000
+++ dcpp/Socket.cpp	2011-09-21 17:51:13 +0000
@@ -636,7 +636,7 @@
  * @throw SocketException Select or the connection attempt failed.
  */
 std::pair<bool, bool> Socket::wait(uint32_t millis, bool checkRead, bool checkWrite) {
-	timeval tv { millis/1000, (millis%1000)*1000 };
+	timeval tv = { millis/1000, (millis%1000)*1000 };
 	fd_set rfd, wfd;
 	fd_set *rfdp = NULL, *wfdp = NULL;