mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
THRIFT-4540 buffered transport broken when trying to re-open a formerly closed transport
Client: Delphi Patch: Jens Geyer This closes #1530
This commit is contained in:
parent
99daecdd1d
commit
3c0edfa875
@ -842,8 +842,13 @@ end;
|
||||
procedure TSocketImpl.Close;
|
||||
begin
|
||||
inherited Close;
|
||||
|
||||
FInputStream := nil;
|
||||
FOutputStream := nil;
|
||||
|
||||
if FOwnsClient
|
||||
then FreeAndNil( FClient);
|
||||
then FreeAndNil( FClient)
|
||||
else FClient := nil;
|
||||
end;
|
||||
|
||||
function TSocketImpl.GetIsOpen: Boolean;
|
||||
@ -954,12 +959,13 @@ function TBufferedStreamImpl.IsOpen: Boolean;
|
||||
begin
|
||||
Result := (FWriteBuffer <> nil)
|
||||
and (FReadBuffer <> nil)
|
||||
and (FStream <> nil);
|
||||
and (FStream <> nil)
|
||||
and FStream.IsOpen;
|
||||
end;
|
||||
|
||||
procedure TBufferedStreamImpl.Open;
|
||||
begin
|
||||
// nothing to do
|
||||
FStream.Open;
|
||||
end;
|
||||
|
||||
function TBufferedStreamImpl.Read( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer): Integer;
|
||||
@ -1106,11 +1112,6 @@ begin
|
||||
Create( ATransport, 1024 );
|
||||
end;
|
||||
|
||||
procedure TBufferedTransportImpl.Close;
|
||||
begin
|
||||
FTransport.Close;
|
||||
end;
|
||||
|
||||
constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport; ABufSize: Integer);
|
||||
begin
|
||||
inherited Create;
|
||||
@ -1119,6 +1120,13 @@ begin
|
||||
InitBuffers;
|
||||
end;
|
||||
|
||||
procedure TBufferedTransportImpl.Close;
|
||||
begin
|
||||
FTransport.Close;
|
||||
FInputBuffer := nil;
|
||||
FOutputBuffer := nil;
|
||||
end;
|
||||
|
||||
procedure TBufferedTransportImpl.Flush;
|
||||
begin
|
||||
if FOutputBuffer <> nil then begin
|
||||
@ -1149,6 +1157,7 @@ end;
|
||||
procedure TBufferedTransportImpl.Open;
|
||||
begin
|
||||
FTransport.Open
|
||||
InitBuffers; // we need to get the buffers to match FTransport substreams again
|
||||
end;
|
||||
|
||||
function TBufferedTransportImpl.Read( const pBuf : Pointer; const buflen : Integer; off: Integer; len: Integer): Integer;
|
||||
|
Loading…
Reference in New Issue
Block a user