X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/9763940f8849e5c807566157829a1e6d2c9172ee..7b8a26e75924ecff47d3e347eb4e2685656c728e:/lsocket.pas?ds=sidebyside diff --git a/lsocket.pas b/lsocket.pas index 4596f6b..f359a55 100644 --- a/lsocket.pas +++ b/lsocket.pas @@ -534,7 +534,7 @@ function tlsocket.accept : longint; var FromAddrSize : LongInt; // i don't really know what to do with these at this FromAddr : TInetSockAddrV; // at this point time will tell :) - a:integer; + a,acceptlasterror:integer; begin {$ifdef secondlistener} if (lastsessionfromsecond) then begin @@ -550,11 +550,14 @@ begin {$else} result := system_accept(fdhandlein,fromaddr,fromaddrsize); {$endif} + + if (result = -1) then acceptlasterror := {$ifdef mswindows}getlasterror{$else}socketerror{$endif} else acceptlasterror := 0; + //now we have accepted one request start monitoring for more again eventcore.rmasterset(fdhandlein,true); if result = -1 then begin - raise esocketexception.create('error '+inttostr({$ifdef mswindows}getlasterror{$else}socketerror{$endif})+' while accepting'); + raise esocketexception.create('error '+inttostr(acceptlasterror)+' while accepting'); end; if result > absolutemaxs then begin myfdclose(result);