From: Jens Geyer Date: Fri, 18 Apr 2014 17:46:17 +0000 (+0200) Subject: THRIFT-2456 THttpClient fails when using async support outside Silverlight X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=a131b8f92c2b2386126353d08d2c285e0861e0da;p=common%2Fthrift.git THRIFT-2456 THttpClient fails when using async support outside Silverlight Client: C# Patch: Adam Connelly & Jens Geyer This closes #97 commit 080b28eac31516ef9e3f988a87d890769f0751cd Author: Adam Connelly Date: 2014-04-09T12:46:27Z THRIFT-2456 Support async operations outside Silverlight I altered TTransport to throw the NotSupportedExceptions to make it more obvious what's going on if someone generates their client using the async option, and then uses a transport that doesn't support it. --- diff --git a/.gitignore b/.gitignore index bff08268..1afe0de3 100644 --- a/.gitignore +++ b/.gitignore @@ -110,8 +110,8 @@ node_modules /lib/c_glib/test/testtransportsocket /lib/c_glib/thriftc.pc /lib/c_glib/thrift_c_glib.pc -/lib/csharp/src/bin/ -/lib/csharp/src/obj/ +/lib/csharp/**/bin/ +/lib/csharp/**/obj/ /lib/d/libthriftd.a /lib/d/test/serialization_benchmark /lib/d/test/transport_test diff --git a/lib/csharp/src/Transport/THttpClient.cs b/lib/csharp/src/Transport/THttpClient.cs index 78653f3b..d19b7a76 100644 --- a/lib/csharp/src/Transport/THttpClient.cs +++ b/lib/csharp/src/Transport/THttpClient.cs @@ -216,7 +216,6 @@ namespace Thrift.Transport return connection; } -#if SILVERLIGHT public override IAsyncResult BeginFlush(AsyncCallback callback, object state) { // Extract request and reset buffer @@ -267,7 +266,6 @@ namespace Thrift.Transport } - private void GetRequestStreamCallback(IAsyncResult asynchronousResult) { var flushAsyncResult = (FlushAsyncResult)asynchronousResult.AsyncState; @@ -375,7 +373,6 @@ namespace Thrift.Transport } } -#endif #region " IDisposable Support " private bool _IsDisposed; diff --git a/lib/csharp/src/Transport/TTransport.cs b/lib/csharp/src/Transport/TTransport.cs index c03e9c22..745aa789 100644 --- a/lib/csharp/src/Transport/TTransport.cs +++ b/lib/csharp/src/Transport/TTransport.cs @@ -76,11 +76,16 @@ namespace Thrift.Transport public virtual IAsyncResult BeginFlush(AsyncCallback callback, object state) { - return null; + throw new TTransportException( + TTransportException.ExceptionType.Unknown, + "Asynchronous operations are not supported by this transport."); } public virtual void EndFlush(IAsyncResult asyncResult) { + throw new TTransportException( + TTransportException.ExceptionType.Unknown, + "Asynchronous operations are not supported by this transport."); } #region " IDisposable Support "