Closed artemii235 closed 5 years ago
Note that IP detection was ported from MM1.
Correct me if I'm wrong, but the failure is likely due to NAT (this is when the external IP doesn't match the IP of the interface) and the nanomsg binding wouldn't know how to work from behind NAT anyway, unless the user has manual port forwarding configured or something like that.
What's different from MM1 though is that the myipaddr
was ignored in some of the MM1 bindings (using 0.0.0.0 instead). We shouldn't repeat this 0.0.0.0 workaround though, because it prevents multiple MM2 instances from coexisting during the automatic testing and such.
I suggest removing the IP detection code and using 0.0.0.0 in place of myipaddr
by default, but not ignoring myipaddr
like MM1 did.
@ArtemGr Hi, the current workaround for users is to explicitly set 127.0.0.1
as myipaddr
for such case. Maybe we can bind on 127.0.0.1
if we fail to bind on myipaddr
or just do not attempt to bind on it at all?
@artemii235 , sounds good, will try to implement in that order.
@ArtemGr I've found where it comes from, this code https://github.com/artemii235/SuperNET/blob/mm2/iguana/exchanges/LP_network.c#L862 does just exit(1)
if bind fails, we can change it to return(-1)
and then it just works :slightly_smiling_face: I've tested it locally.
There's one more place above when it can just exit: https://github.com/artemii235/SuperNET/blob/mm2/iguana/exchanges/LP_network.c#L850
IP detection was improved recently to include the actual HTTP communication.
MM2 gets public IP and attempts to bind port on it.
myipaddr
to "0.0.0.0" if binding on the automatically detected IP fails.