Azure / azure-relay-bridge

Azure Relay Bridge - A cross-platform command line tool to create VPN-less TCP tunnels from and to anywhere
MIT License
121 stars 48 forks source link

Error : An item with the same key has already been added. #15

Closed sengiv closed 2 months ago

sengiv commented 4 years ago

When I use this in my config Multiple listener binding:

   - RelayName: myrelay
     Bindings:          
      - BindAddress: 127.0.8.1
        BindPort: 5671
        PortName: amqps 
      - BindAddress: 127.0.8.1
        BindPort: 5672    
        PortName: amqp

Full error [04/01/2020 03:07:11], LocalForwardBridgeStartFailure, a7e16aeb-7c4f-4996-b5c3-f8b141099773, { localForward = Microsoft.Azure.Relay.Bridge.Configuration.LocalForward, exception = System.ArgumentException: An item with the same key has already been added. Key: sb://radica.servicebus.windows.net/myrelay at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value) at Microsoft.Azure.Relay.Bridge.LocalForwardHost.StartEndpoint(LocalForward localForward, LocalForwardBinding binding) in C:\Users\Raynon\Desktop\AzureVPN\azure-relay-bridge-master4\azure-relay-bridge-master\src\Microsoft.Azure.Relay.Bridge\LocalForwardHost.cs:line 121 } An item with the same key has already been added. Key: sb://radica.servicebus.windows.net/myrelay

robwafle commented 3 years ago

I may have a simple fix for this.

change:

this.listenerBridges.Add(hybridConnectionUri.AbsoluteUri, tcpListenerBridge);
to:
this.listenerBridges.Add(hybridConnectionUri.AbsoluteUri + "-" + binding.PortName, tcpListenerBridge);

I'm working to validate this change, if it works I'll submit a PR.

pjquirk commented 2 years ago

👋 I'm hitting this as well. Is there anything in the proposed fix above that needs improvement, or can we push a PR through?