THRIFT-2696 Unable to stop socket server while there are idle clients
Client: Delphi
Patch: Jens Geyer & Severian Duchenko
diff --git a/lib/delphi/src/Thrift.Server.pas b/lib/delphi/src/Thrift.Server.pas
index 8237a47..2fb5c90 100644
--- a/lib/delphi/src/Thrift.Server.pas
+++ b/lib/delphi/src/Thrift.Server.pas
@@ -325,6 +325,17 @@
       InputProtocol := nil;
       OutputProtocol := nil;
 
+      // close any old connections before before waiting for new clients
+      if client <> nil then try
+        try
+          client.Close;
+        finally
+          client := nil;
+        end;
+      except
+        // catch all, we can't do much about it at this point
+      end;
+
       client := FServerTransport.Accept( procedure
                                          begin
                                            if FServerEvents <> nil