diff options
author | Jens Geyer <jensg@apache.org> | 2019-02-05 01:00:02 +0100 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2019-02-05 09:08:24 +0100 |
commit | adde44b0f542c97dc7e9b2678be53705006c05e3 (patch) | |
tree | 13be3deb770951e31bf14a3e220c7a08805dc0a4 /lib/netstd | |
parent | 8fdb7587e688ae66a0e30e9f22bf8dc09599b2e9 (diff) | |
download | thrift-adde44b0f542c97dc7e9b2678be53705006c05e3.tar.gz |
THRIFT-4772 fully enable server-side usage of framed/buffered transports
Client: netstd
Patch: Jens Geyer
This closes #1729
Diffstat (limited to 'lib/netstd')
-rw-r--r-- | lib/netstd/Thrift/Server/TServer.cs | 6 | ||||
-rw-r--r-- | lib/netstd/Thrift/TApplicationException.cs | 2 | ||||
-rw-r--r-- | lib/netstd/Thrift/Transport/TBufferedTransport.cs (renamed from lib/netstd/Thrift/Transport/Client/TBufferedTransport.cs) | 10 | ||||
-rw-r--r-- | lib/netstd/Thrift/Transport/TFramedTransport.cs (renamed from lib/netstd/Thrift/Transport/Client/TFramedTransport.cs) | 10 | ||||
-rw-r--r-- | lib/netstd/Thrift/Transport/TTransportException.cs | 2 |
5 files changed, 23 insertions, 7 deletions
diff --git a/lib/netstd/Thrift/Server/TServer.cs b/lib/netstd/Thrift/Server/TServer.cs index 3a70c0773..b351913ce 100644 --- a/lib/netstd/Thrift/Server/TServer.cs +++ b/lib/netstd/Thrift/Server/TServer.cs @@ -45,8 +45,8 @@ namespace Thrift.Server { ProcessorFactory = processorFactory ?? throw new ArgumentNullException(nameof(processorFactory)); ServerTransport = serverTransport; - InputTransportFactory = inputTransportFactory ?? throw new ArgumentNullException(nameof(inputTransportFactory)); - OutputTransportFactory = outputTransportFactory ?? throw new ArgumentNullException(nameof(outputTransportFactory)); + InputTransportFactory = inputTransportFactory ?? new TTransportFactory(); + OutputTransportFactory = outputTransportFactory ?? new TTransportFactory(); InputProtocolFactory = inputProtocolFactory ?? throw new ArgumentNullException(nameof(inputProtocolFactory)); OutputProtocolFactory = outputProtocolFactory ?? throw new ArgumentNullException(nameof(outputProtocolFactory)); Logger = logger; // null is absolutely legal @@ -84,4 +84,4 @@ namespace Thrift.Server } } } -}
\ No newline at end of file +} diff --git a/lib/netstd/Thrift/TApplicationException.cs b/lib/netstd/Thrift/TApplicationException.cs index 50f65d647..9c86898af 100644 --- a/lib/netstd/Thrift/TApplicationException.cs +++ b/lib/netstd/Thrift/TApplicationException.cs @@ -44,7 +44,7 @@ namespace Thrift private const int MessageTypeFieldId = 1; private const int ExTypeFieldId = 2; - protected ExceptionType Type; + public ExceptionType Type { get; private set; } public TApplicationException() { diff --git a/lib/netstd/Thrift/Transport/Client/TBufferedTransport.cs b/lib/netstd/Thrift/Transport/TBufferedTransport.cs index b8b5f53dc..c648f5cdb 100644 --- a/lib/netstd/Thrift/Transport/Client/TBufferedTransport.cs +++ b/lib/netstd/Thrift/Transport/TBufferedTransport.cs @@ -20,7 +20,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -namespace Thrift.Transport.Client +namespace Thrift.Transport { // ReSharper disable once InconsistentNaming public class TBufferedTransport : TTransport @@ -31,6 +31,14 @@ namespace Thrift.Transport.Client private readonly TTransport _transport; private bool _isDisposed; + public class Factory : TTransportFactory + { + public override TTransport GetTransport(TTransport trans) + { + return new TBufferedTransport(trans); + } + } + //TODO: should support only specified input transport? public TBufferedTransport(TTransport transport, int bufSize = 1024) { diff --git a/lib/netstd/Thrift/Transport/Client/TFramedTransport.cs b/lib/netstd/Thrift/Transport/TFramedTransport.cs index 7b764dfbe..59963f1e9 100644 --- a/lib/netstd/Thrift/Transport/Client/TFramedTransport.cs +++ b/lib/netstd/Thrift/Transport/TFramedTransport.cs @@ -20,7 +20,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -namespace Thrift.Transport.Client +namespace Thrift.Transport { //TODO: check for correct implementation @@ -35,6 +35,14 @@ namespace Thrift.Transport.Client private bool _isDisposed; + public class Factory : TTransportFactory + { + public override TTransport GetTransport(TTransport trans) + { + return new TFramedTransport(trans); + } + } + public TFramedTransport(TTransport transport) { _transport = transport ?? throw new ArgumentNullException(nameof(transport)); diff --git a/lib/netstd/Thrift/Transport/TTransportException.cs b/lib/netstd/Thrift/Transport/TTransportException.cs index 7469b8ba2..760a178e6 100644 --- a/lib/netstd/Thrift/Transport/TTransportException.cs +++ b/lib/netstd/Thrift/Transport/TTransportException.cs @@ -32,7 +32,7 @@ namespace Thrift.Transport Interrupted } - protected ExceptionType ExType; + public ExceptionType ExType { get; private set; } public TTransportException() { |