diff options
Diffstat (limited to 'lib/csharp/src/Transport/TBufferedTransport.cs')
-rw-r--r-- | lib/csharp/src/Transport/TBufferedTransport.cs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/csharp/src/Transport/TBufferedTransport.cs b/lib/csharp/src/Transport/TBufferedTransport.cs index 76c6b1a7b..887098810 100644 --- a/lib/csharp/src/Transport/TBufferedTransport.cs +++ b/lib/csharp/src/Transport/TBufferedTransport.cs @@ -81,7 +81,7 @@ namespace Thrift.Transport inputBuffer.Capacity = bufSize; while (true) - { + { int got = inputBuffer.Read(buf, off, len); if (got > 0) return got; @@ -129,9 +129,8 @@ namespace Thrift.Transport } } - public override void Flush() + private void InternalFlush() { - CheckNotDisposed(); if (!IsOpen) throw new TTransportException(TTransportException.ExceptionType.NotOpen); if (outputBuffer.Length > 0) @@ -139,9 +138,31 @@ namespace Thrift.Transport transport.Write(outputBuffer.GetBuffer(), 0, (int)outputBuffer.Length); outputBuffer.SetLength(0); } + } + + public override void Flush() + { + CheckNotDisposed(); + InternalFlush(); + transport.Flush(); } + public override IAsyncResult BeginFlush(AsyncCallback callback, object state) + { + CheckNotDisposed(); + InternalFlush(); + + return transport.BeginFlush( callback, state); + } + + public override void EndFlush(IAsyncResult asyncResult) + { + transport.EndFlush( asyncResult); + } + + + protected void CheckNotDisposed() { if (_IsDisposed) |