THRIFT-5021 Implement MAX_MESSAGE_SIZE and centralize limits into a TConfiguration class
Client: netstd
Patch: Jens Geyer
This closes #1943
diff --git a/tutorial/netstd/Client/Program.cs b/tutorial/netstd/Client/Program.cs
index f9509fa..857b3e8 100644
--- a/tutorial/netstd/Client/Program.cs
+++ b/tutorial/netstd/Client/Program.cs
@@ -40,6 +40,7 @@
{
private static ServiceCollection ServiceCollection = new ServiceCollection();
private static ILogger Logger;
+ private static readonly TConfiguration Configuration = null; // new TConfiguration() if needed
private static void DisplayHelp()
{
@@ -143,7 +144,7 @@
private static TTransport GetTransport(string[] args)
{
- TTransport transport = new TSocketTransport(IPAddress.Loopback, 9090);
+ TTransport transport = new TSocketTransport(IPAddress.Loopback, 9090, Configuration);
// construct endpoint transport
var transportArg = args.FirstOrDefault(x => x.StartsWith("-tr"))?.Split(':')?[1];
@@ -152,19 +153,20 @@
switch (selectedTransport)
{
case Transport.Tcp:
- transport = new TSocketTransport(IPAddress.Loopback, 9090);
+ transport = new TSocketTransport(IPAddress.Loopback, 9090, Configuration);
break;
case Transport.NamedPipe:
- transport = new TNamedPipeTransport(".test");
+ transport = new TNamedPipeTransport(".test", Configuration);
break;
case Transport.Http:
- transport = new THttpTransport(new Uri("http://localhost:9090"), null);
+ transport = new THttpTransport(new Uri("http://localhost:9090"), Configuration);
break;
case Transport.TcpTls:
- transport = new TTlsSocketTransport(IPAddress.Loopback, 9090, GetCertificate(), CertValidator, LocalCertificateSelectionCallback);
+ transport = new TTlsSocketTransport(IPAddress.Loopback, 9090, Configuration,
+ GetCertificate(), CertValidator, LocalCertificateSelectionCallback);
break;
default:
diff --git a/tutorial/netstd/Server/Program.cs b/tutorial/netstd/Server/Program.cs
index e1dab01..c1e0cb3 100644
--- a/tutorial/netstd/Server/Program.cs
+++ b/tutorial/netstd/Server/Program.cs
@@ -44,6 +44,7 @@
{
private static ServiceCollection ServiceCollection = new ServiceCollection();
private static ILogger Logger;
+ private static readonly TConfiguration Configuration = null; // new TConfiguration() if needed
public static void Main(string[] args)
{
@@ -163,13 +164,14 @@
switch (transport)
{
case Transport.Tcp:
- serverTransport = new TServerSocketTransport(9090);
+ serverTransport = new TServerSocketTransport(9090, Configuration);
break;
case Transport.NamedPipe:
- serverTransport = new TNamedPipeServerTransport(".test");
+ serverTransport = new TNamedPipeServerTransport(".test", Configuration);
break;
case Transport.TcpTls:
- serverTransport = new TTlsServerSocketTransport(9090, GetCertificate(), ClientCertValidator, LocalCertificateSelectionCallback);
+ serverTransport = new TTlsServerSocketTransport(9090, Configuration,
+ GetCertificate(), ClientCertValidator, LocalCertificateSelectionCallback);
break;
}