diff --git a/SuccessfulCodeTools/LowLevelHttpClient/CustomHttpClient.cs b/SuccessfulCodeTools/LowLevelHttpClient/CustomHttpClient.cs index 7bc6152..e24395b 100644 --- a/SuccessfulCodeTools/LowLevelHttpClient/CustomHttpClient.cs +++ b/SuccessfulCodeTools/LowLevelHttpClient/CustomHttpClient.cs @@ -17,7 +17,6 @@ namespace SuccessfulCodeTools.LowLevelHttpClient { public int? OutgoingPort { get; set; } public KeyValueCollection DefaultHeaders = new KeyValueCollection(); - private static readonly ConcurrentDictionary _dictionary = new ConcurrentDictionary(); public CustomHttpClient(int? outgoingPort = null) { OutgoingPort = outgoingPort; @@ -30,8 +29,7 @@ namespace SuccessfulCodeTools.LowLevelHttpClient message.Headers.AddRange(defaultHeaders); var outBoundPort = outgoingPort ?? OutgoingPort ?? 0; - var semphoreLock = (SemaphoreSlim)_dictionary.GetOrAdd(outBoundPort, e => new SemaphoreSlim(1)); - semphoreLock.Wait(); + var ipLocalEndPoint = new IPEndPoint(IPAddress.Any, outBoundPort); using (var tcp = new TcpClient(ipLocalEndPoint)) { @@ -60,7 +58,6 @@ namespace SuccessfulCodeTools.LowLevelHttpClient tcp.Client.Disconnect(true); stream.Close(); tcp.Client.Close(); - semphoreLock.Release(); return new CustomHttpResponseMessage(memory); } }