From: beware Date: Tue, 12 Oct 2021 21:32:15 +0000 (+0000) Subject: windows: fix that an immediate connect error is not seen and the socket is stuck... X-Git-Url: http://www.lcore.org/git/lcore.git/commitdiff_plain/2ba734680253339d8b27208a1dfec5e2f220f3d8 windows: fix that an immediate connect error is not seen and the socket is stuck connecting forever git-svn-id: file:///svnroot/lcore/trunk@163 b1de8a11-f9be-4011-bde0-cc7ace90066a --- diff --git a/lsocket.pas b/lsocket.pas index f359a55..6a4034d 100644 --- a/lsocket.pas +++ b/lsocket.pas @@ -256,13 +256,16 @@ begin end else begin state :=wsconnecting; {$ifdef mswindows} + //beware: atleast on windows, wsaasyncselect set interest in events before connecting, or a connect error isn't seen if it happens immediately during connect + eventcore.rmasterset(fdhandlein,false); + eventcore.wmasterset(fdhandleout); //writeln(inaddr.inaddr.port); winsock.Connect(fdhandlein,winsock.psockaddr(@inADDR)^,getaddrsize); {$else} system_Connect(fdhandlein,inADDR,getaddrsize); + eventcore.rmasterset(fdhandlein,false); + eventcore.wmasterset(fdhandleout); {$endif} - eventcore.rmasterset(fdhandlein,false); - eventcore.wmasterset(fdhandleout); if trymoreips then connecttimeout.enabled := true; end; //sendq := '';