Skip to content

Commit 4a63a91

Browse files
committed
fix: incorrect epmd node formatting
this was preventing NodePortMapper from properly registering nodes, causing disconnections and crashes when more than one engine node was spawned.
1 parent 60fad44 commit 4a63a91

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/forge/lib/forge/epmd.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,19 @@ defmodule Forge.EPMD do
8282
end
8383

8484
def port_please(~c"expert-project-" ++ _ = name, host, timeout) do
85-
if port = Forge.NodePortMapper.get_port(List.to_atom(name)) do
85+
host_string = format_host(host)
86+
full_node = :"#{name}@#{host_string}"
87+
88+
if port = Forge.NodePortMapper.get_port(full_node) do
8689
{:port, port, @epmd_dist_version}
8790
else
8891
:erl_epmd.port_please(name, host, timeout)
8992
end
9093
end
9194

95+
defp format_host({a, b, c, d}), do: "#{a}.#{b}.#{c}.#{d}"
96+
defp format_host(host) when is_list(host), do: List.to_string(host)
97+
9298
def port_please(name, host, timeout) do
9399
:erl_epmd.port_please(name, host, timeout)
94100
end

0 commit comments

Comments
 (0)