THRIFT-5422 add threadpool server to netstd test suite impl
Client: netstd
Patch: Jens Geyer
This closes #2398
diff --git a/lib/netstd/Thrift/Server/TThreadPoolAsyncServer.cs b/lib/netstd/Thrift/Server/TThreadPoolAsyncServer.cs
index 877d595..7a5254a 100644
--- a/lib/netstd/Thrift/Server/TThreadPoolAsyncServer.cs
+++ b/lib/netstd/Thrift/Server/TThreadPoolAsyncServer.cs
@@ -29,6 +29,9 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
+#pragma warning disable IDE0079 // remove unnecessary pragmas
+#pragma warning disable IDE0063 // using can be simplified, we don't
+
namespace Thrift.Server
{
/// <summary>
@@ -125,8 +128,7 @@
{
if ((threadConfig.MaxWorkerThreads > 0) || (threadConfig.MaxIOThreads > 0))
{
- int work, comm;
- ThreadPool.GetMaxThreads(out work, out comm);
+ ThreadPool.GetMaxThreads(out int work, out int comm);
if (threadConfig.MaxWorkerThreads > 0)
work = threadConfig.MaxWorkerThreads;
if (threadConfig.MaxIOThreads > 0)
@@ -137,8 +139,7 @@
if ((threadConfig.MinWorkerThreads > 0) || (threadConfig.MinIOThreads > 0))
{
- int work, comm;
- ThreadPool.GetMinThreads(out work, out comm);
+ ThreadPool.GetMinThreads(out int work, out int comm);
if (threadConfig.MinWorkerThreads > 0)
work = threadConfig.MinWorkerThreads;
if (threadConfig.MinIOThreads > 0)
@@ -209,7 +210,7 @@
}
finally
{
- ServerCancellationToken = default(CancellationToken);
+ ServerCancellationToken = default;
}
}
@@ -255,6 +256,7 @@
//actually arriving or the client may hang up without ever makeing a request.
if (ServerEventHandler != null)
ServerEventHandler.ProcessContextAsync(connectionContext, inputTransport, cancellationToken).Wait();
+
//Process client request (blocks until transport is readable)
if (!processor.ProcessAsync(inputProtocol, outputProtocol, cancellationToken).Result)
break;