Browse Source

* Do not raise error if a connection was created during accept, silently drop the connection

git-svn-id: trunk@33734 -
michael 9 years ago
parent
commit
c05373bfe1
1 changed files with 5 additions and 2 deletions
  1. 5 2
      packages/fcl-net/src/ssockets.pp

+ 5 - 2
packages/fcl-net/src/ssockets.pp

@@ -855,8 +855,11 @@ begin
 {$endif}
   if (Result<0) or Not (FAccepting and FHandler.Accept) then
     begin
-    CloseSocket(Result);
-    Raise ESocketError.Create(seAcceptFailed,[Socket,SocketError])
+    If (Result>=0) then
+      CloseSocket(Result);
+    // Do not raise an error if we've stopped accepting.
+    if FAccepting then
+      Raise ESocketError.Create(seAcceptFailed,[Socket,SocketError])
     end;
 end;