fcl-net: clean up and keep stacktrace

This commit is contained in:
mattias 2023-07-07 11:16:50 +02:00
parent 486f3a0c7f
commit 8f4b56d10e

View File

@ -161,7 +161,6 @@ type
FOnIdle : TNotifyEvent;
FNonBlocking : Boolean;
FSocket : longint;
FListened : Boolean;
FAccepting : Boolean;
FMaxConnections : Longint;
FQueueSize : Longint;
@ -341,7 +340,6 @@ uses
resolve;
Const
SocketWouldBlock = -2;
SocketBlockingMode = 0;
SocketNonBlockingMode = 1;
@ -868,8 +866,11 @@ begin
end;
procedure TSocketServer.Abort;
{$if defined(unix) or defined(mswindows) or defined(hasamiga)}
{$else}
var
ASocket: longint;
{$endif}
begin
{$if defined(unix)}
fpShutdown(FSocket,SHUT_RDWR);
@ -1003,11 +1004,10 @@ begin
Listen;
Repeat
Repeat
Stream:=Nil;
Try
If (AcceptIdleTimeOut=0) or RunIdleLoop then
Stream:=GetConnection
else
Stream:=Nil;
Stream:=GetConnection;
if Assigned(Stream) then
if (MaxSimultaneousConnections>0) and (ConnectionCount>=MaxSimultaneousConnections) then
begin
@ -1257,7 +1257,7 @@ end;
function TInetServer.SockToStream(ASocket: Longint): TSocketStream;
Var
H : TSocketHandler;
A : Boolean;
ok : Boolean;
aClass : TInetSocketClass;
procedure ShutDownH;
@ -1266,7 +1266,6 @@ Var
FreeAndNil(Result);
end;
begin
H:=GetClientSocketHandler(aSocket);
aClass:=DefaultInetSocketClass;
@ -1276,14 +1275,13 @@ begin
(Result as TInetSocket).FHost:='';
(Result as TInetSocket).FPort:=FPort;
ok:=false;
try
A:=H.Accept;
except
ShutDownH;
raise;
ok:=H.Accept;
finally
if not ok then
ShutDownH;
end;
if Not A then
ShutDownH;
end;
function TInetServer.Accept: Longint;