Fixed two reliability issues highlighted by SonarCloud (#44)
This commit is contained in:
parent
a2e8ecc23d
commit
967d7a4cc8
3 changed files with 10 additions and 4 deletions
|
|
@ -169,9 +169,12 @@ public sealed class StdioServerTransport : TransportBase, IServerTransport
|
|||
{
|
||||
_logger.TransportCleaningUp(EndpointName);
|
||||
|
||||
_shutdownCts?.Cancel();
|
||||
_shutdownCts?.Dispose();
|
||||
_shutdownCts = null;
|
||||
if (_shutdownCts != null)
|
||||
{
|
||||
await _shutdownCts.CancelAsync().ConfigureAwait(false);
|
||||
_shutdownCts.Dispose();
|
||||
_shutdownCts = null;
|
||||
}
|
||||
|
||||
if (_readTask != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ using McpDotNet.Server;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
|
||||
namespace McpDotNet.TestServer;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static ILoggerFactory CreateLoggerFactory()
|
||||
|
|
@ -336,7 +338,7 @@ internal static class Program
|
|||
Log.Logger.Information("Server started.");
|
||||
|
||||
// Run until process is stopped by the client (parent process)
|
||||
while (true)
|
||||
while (true) // NOSONAR
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>TestServer</AssemblyName>
|
||||
<RootNamespace>McpDotNet.TestServer</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue