Skip to content

Commit 88ea834

Browse files
author
Evan Yang
committed
fix running out of ports when SkyWalking server unavailable
1 parent e7633b0 commit 88ea834

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/SkyApm.Transport.Grpc/ConnectionManager.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public async Task ConnectAsync()
6767
//https://docs.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-3.0#call-insecure-grpc-services-with-net-core-client-2
6868
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
6969

70-
_channel = GrpcChannel.ForAddress(_server);
70+
_channel = GrpcChannel.ForAddress(_server, new GrpcChannelOptions { DisposeHttpClient = true });
7171
_state = ConnectionState.Connected;
7272
_logger.Information($"Connected server[{_channel.Target}].");
7373
}
@@ -97,6 +97,7 @@ public async Task ShutdownAsync()
9797
}
9898
finally
9999
{
100+
_channel?.Dispose();
100101
_state = ConnectionState.Failure;
101102
}
102103
}

0 commit comments

Comments
 (0)