Repository: thrift Updated Branches: refs/heads/master 8b14d179c -> 2ad6c307b
THRIFT-3012 Timing problems in NamedPipe implementation due to unnecessary open/close Client: Delphi Patch: Jens Geyer Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/2ad6c307 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/2ad6c307 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/2ad6c307 Branch: refs/heads/master Commit: 2ad6c307be41c4ddc8ea2887acd93b9b3331cc6a Parents: 8b14d17 Author: Jens Geyer <[email protected]> Authored: Thu Feb 26 19:38:53 2015 +0100 Committer: Jens Geyer <[email protected]> Committed: Fri Feb 27 00:39:36 2015 +0100 ---------------------------------------------------------------------- lib/delphi/src/Thrift.Transport.Pipes.pas | 9 +++++---- lib/delphi/test/TestClient.pas | 9 +++++---- lib/delphi/test/TestServer.pas | 7 +------ 3 files changed, 11 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/2ad6c307/lib/delphi/src/Thrift.Transport.Pipes.pas ---------------------------------------------------------------------- diff --git a/lib/delphi/src/Thrift.Transport.Pipes.pas b/lib/delphi/src/Thrift.Transport.Pipes.pas index 48eb5e2..593bb3a 100644 --- a/lib/delphi/src/Thrift.Transport.Pipes.pas +++ b/lib/delphi/src/Thrift.Transport.Pipes.pas @@ -227,7 +227,7 @@ type public constructor Create( aPipename : string; aBufsize : Cardinal = 4096; aMaxConns : Cardinal = PIPE_UNLIMITED_INSTANCES; - aTimeOut : Cardinal = 0); + aTimeOut : Cardinal = INFINITE); end; @@ -816,10 +816,11 @@ begin overlapped := TOverlappedHelperImpl.Create; ASSERT( not FConnected); + CreateNamedPipe; while not FConnected do begin - InternalClose; - if QueryStopServer then Abort; - CreateNamedPipe; + + if QueryStopServer + then Abort; if Assigned(fnAccepting) then fnAccepting(); http://git-wip-us.apache.org/repos/asf/thrift/blob/2ad6c307/lib/delphi/test/TestClient.pas ---------------------------------------------------------------------- diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas index 6f155a2..ec30109 100644 --- a/lib/delphi/test/TestClient.pas +++ b/lib/delphi/test/TestClient.pas @@ -481,18 +481,19 @@ begin except on e:TTransportException do begin Console.WriteLine( e.ClassName+' = '+e.Message); // this is what we get - if FTransport.IsOpen then FTransport.Close; - FTransport.Open; // re-open connection, server has already closed end; on e:TApplicationException do begin Console.WriteLine( e.ClassName+' = '+e.Message); // this is what we get - if FTransport.IsOpen then FTransport.Close; - FTransport.Open; // re-open connection, server has already closed end; on e:TException do Expect( FALSE, 'Unexpected exception type "'+e.ClassName+'"'); on e:Exception do Expect( FALSE, 'Unexpected exception type "'+e.ClassName+'"'); end; + { + if FTransport.IsOpen then FTransport.Close; + FTransport.Open; // re-open connection, server has already closed + } + // case 3: no exception try client.testException('something'); http://git-wip-us.apache.org/repos/asf/thrift/blob/2ad6c307/lib/delphi/test/TestServer.pas ---------------------------------------------------------------------- diff --git a/lib/delphi/test/TestServer.pas b/lib/delphi/test/TestServer.pas index ad4823f..55384ed 100644 --- a/lib/delphi/test/TestServer.pas +++ b/lib/delphi/test/TestServer.pas @@ -536,11 +536,6 @@ var endpoint : TEndpointTransport; layered : TLayeredTransports; UseSSL : Boolean; // include where appropriate (TLayeredTransport?) -const - // pipe timeouts to be used - DEBUG_TIMEOUT = 30 * 1000; - RELEASE_TIMEOUT = DEFAULT_THRIFT_TIMEOUT; // server-side default - TIMEOUT = RELEASE_TIMEOUT; begin try ServerEvents := FALSE; @@ -663,7 +658,7 @@ begin trns_NamedPipes : begin Console.WriteLine('- named pipe ('+sPipeName+')'); - namedpipe := TNamedPipeServerTransportImpl.Create( sPipeName, 4096, PIPE_UNLIMITED_INSTANCES, TIMEOUT); + namedpipe := TNamedPipeServerTransportImpl.Create( sPipeName, 4096, PIPE_UNLIMITED_INSTANCES); servertrans := namedpipe; end;
