From 2ba734680253339d8b27208a1dfec5e2f220f3d8 Mon Sep 17 00:00:00 2001 From: beware Date: Tue, 12 Oct 2021 21:32:15 +0000 Subject: [PATCH] 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 --- lsocket.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 := ''; -- 2.30.2