Skip to content

Commit 16f97fd

Browse files
Update Worker.ex
1 parent 16d192b commit 16f97fd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Worker.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ defmodule BitcoinMining.Worker do
1414
{ip_tuple,_,_} = head
1515
current_ip = to_string(:inet_parse.ntoa(ip_tuple))
1616
if current_ip === "127.0.0.1" do
17-
if l != 1 do
17+
if l > 1 do
1818
make_distributed(tail,l-1)
19+
else
20+
IO.puts "Could not make current node distributed."
1921
end
2022
else
2123
server_node_name = String.to_atom("worker@" <> current_ip)
2224
Node.start(server_node_name)
2325
Node.set_cookie(server_node_name,:monster)
2426
end
2527
rescue
26-
_ -> if l != 1, do: make_distributed(tail,l-1), else: IO.puts "Could not make current node distributed."
28+
_ -> if l > 1, do: make_distributed(tail,l-1), else: IO.puts "Could not make current node distributed."
2729
end
2830
end
2931
end

0 commit comments

Comments
 (0)