You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/04/18 19:47:36 UTC

git commit: THRIFT-2456 THttpClient fails when using async support outside Silverlight Client: C# Patch: Adam Connelly & Jens Geyer

Repository: thrift
Updated Branches:
  refs/heads/master e8c51ed9c -> a131b8f92


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 <ad...@resdiary.com>
 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.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/a131b8f9
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/a131b8f9
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/a131b8f9

Branch: refs/heads/master
Commit: a131b8f92c2b2386126353d08d2c285e0861e0da
Parents: e8c51ed
Author: Jens Geyer <je...@apache.org>
Authored: Fri Apr 18 19:46:17 2014 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Apr 18 19:46:17 2014 +0200

----------------------------------------------------------------------
 .gitignore                              | 4 ++--
 lib/csharp/src/Transport/THttpClient.cs | 3 ---
 lib/csharp/src/Transport/TTransport.cs  | 7 ++++++-
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/a131b8f9/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index bff0826..1afe0de 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

http://git-wip-us.apache.org/repos/asf/thrift/blob/a131b8f9/lib/csharp/src/Transport/THttpClient.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Transport/THttpClient.cs b/lib/csharp/src/Transport/THttpClient.cs
index 78653f3..d19b7a7 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;
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/a131b8f9/lib/csharp/src/Transport/TTransport.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Transport/TTransport.cs b/lib/csharp/src/Transport/TTransport.cs
index c03e9c2..745aa78 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 "