Skip to content

Commit

Permalink
Revert "Revert "Merge pull request helium#868 from helium/pevm/clarif…
Browse files Browse the repository at this point in the history
…y-connected""

This reverts commit 5eb837b.
  • Loading branch information
PaulVMo committed Aug 16, 2021
1 parent bca8473 commit 54821ab
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/miner.erl
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,18 @@ block_age() ->
-spec p2p_status() -> [{Check::string(), Result::string()}].
p2p_status() ->
SwarmTID = blockchain_swarm:tid(),
In = application:get_env(blockchain, max_inbound_connections, 2),
Out = application:get_env(blockchain, outbound_gossip_connections, 6),

SessionCt =
try
length(libp2p_swarm:sessions(SwarmTID))
catch _:_ ->
0
end,

CheckSessions = fun() ->
case (catch length(libp2p_swarm:sessions(SwarmTID)) > 5) of
case (SessionCt > ((In + Out) / 2)) of
true -> "yes";
_ -> "no"
end
Expand Down Expand Up @@ -172,7 +182,8 @@ p2p_status() ->
end,
lists:foldr(fun({Fun, Name}, Acc) ->
[{Name, Fun()} | Acc]
end, [], [{CheckSessions, "connected"},
end, [], [{CheckSessions, "well-connected"},
{fun() -> integer_to_list(SessionCt) end, "sessions"},
{CheckPublicAddr, "dialable"},
{CheckNatType, "nat_type"},
{CheckHeight, "height"}]).
Expand Down

0 comments on commit 54821ab

Please sign in to comment.