mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
THRIFT-4673 IAsyncResult not supported by layered transports (buffered/framed)
Client: C# Patch: Jens Geyer This closes #1634
This commit is contained in:
parent
7abb7d5fbc
commit
fc52c3ccee
@ -81,7 +81,7 @@ namespace Thrift.Transport
|
|||||||
inputBuffer.Capacity = bufSize;
|
inputBuffer.Capacity = bufSize;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int got = inputBuffer.Read(buf, off, len);
|
int got = inputBuffer.Read(buf, off, len);
|
||||||
if (got > 0)
|
if (got > 0)
|
||||||
return got;
|
return got;
|
||||||
@ -129,9 +129,8 @@ namespace Thrift.Transport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Flush()
|
private void InternalFlush()
|
||||||
{
|
{
|
||||||
CheckNotDisposed();
|
|
||||||
if (!IsOpen)
|
if (!IsOpen)
|
||||||
throw new TTransportException(TTransportException.ExceptionType.NotOpen);
|
throw new TTransportException(TTransportException.ExceptionType.NotOpen);
|
||||||
if (outputBuffer.Length > 0)
|
if (outputBuffer.Length > 0)
|
||||||
@ -139,9 +138,31 @@ namespace Thrift.Transport
|
|||||||
transport.Write(outputBuffer.GetBuffer(), 0, (int)outputBuffer.Length);
|
transport.Write(outputBuffer.GetBuffer(), 0, (int)outputBuffer.Length);
|
||||||
outputBuffer.SetLength(0);
|
outputBuffer.SetLength(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Flush()
|
||||||
|
{
|
||||||
|
CheckNotDisposed();
|
||||||
|
InternalFlush();
|
||||||
|
|
||||||
transport.Flush();
|
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()
|
protected void CheckNotDisposed()
|
||||||
{
|
{
|
||||||
if (_IsDisposed)
|
if (_IsDisposed)
|
||||||
|
@ -108,7 +108,7 @@ namespace Thrift.Transport
|
|||||||
writeBuffer.Write(buf, off, len);
|
writeBuffer.Write(buf, off, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Flush()
|
private void InternalFlush()
|
||||||
{
|
{
|
||||||
CheckNotDisposed();
|
CheckNotDisposed();
|
||||||
if (!IsOpen)
|
if (!IsOpen)
|
||||||
@ -126,10 +126,29 @@ namespace Thrift.Transport
|
|||||||
transport.Write(buf, 0, len);
|
transport.Write(buf, 0, len);
|
||||||
|
|
||||||
InitWriteBuffer();
|
InitWriteBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Flush()
|
||||||
|
{
|
||||||
|
CheckNotDisposed();
|
||||||
|
InternalFlush();
|
||||||
|
|
||||||
transport.Flush();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
private void InitWriteBuffer()
|
private void InitWriteBuffer()
|
||||||
{
|
{
|
||||||
// Reserve space for message header to be put right before sending it out
|
// Reserve space for message header to be put right before sending it out
|
||||||
|
Loading…
Reference in New Issue
Block a user