QSocket bug

Michael Goffioul goffioul at imec.be
Mon Aug 26 12:27:10 BST 2002


By reference to the problem encountered previously in QSocket:

http://lists.kde.org/?t=102447832300003&r=1&w=2

The patch that was posted is IMO wrong.
If the system call "connect" sets errno to EINPROGRESS, then
QSocketDevice::connect() returns true, but the socket is not
actually connected (yet).
With the patch previously posted, you end up with a "connected()"
signal emitted by the QSocket object. while the internal socket
is not connected. Using functions like KExtendedSocket::peerAddress()
may then fail.

The only reliable fix I found for the whole problem, is eventually
to set d->addr, when trying to connect. This seems to solve the
problem with and without the use of any proxy utility.

Bye.
Michael.

-- 
------------------------------------------------------------------
Michael Goffioul		IMEC-DESICS-MIRA
e-mail: goffioul at imec.be	(Mixed-Signal and RF Applications)
Tel:    +32/16/28-8510		Kapeldreef, 75
Fax:    +32/16/28-1515		3001 HEVERLEE, BELGIUM
------------------------------------------------------------------
-------------- next part --------------
Index: network/qsocket.cpp
===================================================================
RCS file: /home/kde/qt-copy/src/network/qsocket.cpp,v
retrieving revision 1.24
diff -u -3 -p -r1.24 qsocket.cpp
--- network/qsocket.cpp	2002/03/15 19:31:56	1.24
+++ network/qsocket.cpp	2002/08/26 11:15:21
@@ -337,6 +337,7 @@ void QSocket::tryConnecting()
     }
 
     if ( d->state == Connecting ) {
+	d->addr = l[ 0 ];
 	// ### hack: just use the first address
 	if ( d->socket->connect( l[0], d->port ) == FALSE ) {
 	    if ( d->socket->error() == QSocketDevice::NoError ) {


More information about the kde-core-devel mailing list