← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2414: fix hangs on exit in active mode with WINE; see https://bugs.launchpad.net/dcplusplus/+bug/704743

 

------------------------------------------------------------
revno: 2414
committer: cologic <ne5@xxxxxxxxxxx>
branch nick: dcplusplus
timestamp: Thu 2011-02-03 14:36:43 -0500
message:
  fix hangs on exit in active mode with WINE; see https://bugs.launchpad.net/dcplusplus/+bug/704743
modified:
  dcpp/SearchManager.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/SearchManager.cpp'
--- dcpp/SearchManager.cpp	2011-01-02 17:12:02 +0000
+++ dcpp/SearchManager.cpp	2011-02-03 19:36:43 +0000
@@ -128,7 +128,12 @@
 
 	while(!stop) {
 		try {
-			while( (len = socket->read(&buf[0], BUFSIZE, remoteAddr)) > 0) {
+			while ( true ) {
+				// @todo: remove this workaround for http://bugs.winehq.org/show_bug.cgi?id=22291
+				// if that's fixed by reverting to simpler while (read(...) > 0) {...} code.
+				while (socket->wait(400, Socket::WAIT_READ) != Socket::WAIT_READ);
+				if (stop || (len = socket->read(&buf[0], BUFSIZE, remoteAddr)) <= 0)
+					break;
 				onData(&buf[0], len, remoteAddr);
 			}
 		} catch(const SocketException& e) {