QSocket problem with transconnect (proxy)?
Michael Goffioul
goffioul at imec.be
Thu Jun 20 14:11:08 BST 2002
> > I think I may have found the bug:
> > when you call connectToHost(), it creates a QDns to do the lookup and connects
> > it to QSocket::tryConnecting(). When that slot gets called, it'll fetch the
> > connection lookup results and try to connect to the first (and only the
> > first) of the returned values, after placing the socket in non-blocking mode.
> >
> > What happens is that it expects connect() to return with failure (errno =
> > EINPROGRESS). What happens is that the local connection is established
> > immediately and the connection then is successful. The QSocket class never
> > leaves the QSocket::Connecting state.
> >
> > By the first time QSocket::sn_write() gets called, it'll see the
> > QSocket::connecting state and instead call QSocket::tryConnection(). That's
> > an error, because:
> > a) the socket is already connected
> > b) d->addr has never got set
> > (actually, I couldn't find where it is ever set)
> >
>
> I modified the patch a little bit to emit the connected signal after the
> read notifier has been enabled, as in tryConnection(). However I still
> don't know how d->addr can be different from 0.0.0.0.
>
> I tested it with transconnect, and it solves the problem.
Sorry, I made a mistake in the patch. Here's a corrected one.
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: qsocket.cpp
===================================================================
RCS file: /home/kdecvs/kde/qt-copy/src/network/qsocket.cpp,v
retrieving revision 1.24
diff -u -3 -p -r1.24 qsocket.cpp
--- qsocket.cpp 15 Mar 2002 19:31:56 -0000 1.24
+++ qsocket.cpp 20 Jun 2002 13:09:53 -0000
@@ -358,7 +358,13 @@ void QSocket::tryConnecting()
// The socket write notifier will fire when the connection succeeds
if ( d->wsn )
d->wsn->setEnabled( TRUE );
- }
+
+ // If we got here, the connection has been established
+ d->state = Connected;
+ if ( d->rsn )
+ d->rsn->setEnabled( TRUE );
+ emit connected();
+ }
#endif
}
More information about the kde-core-devel
mailing list