Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #359 from helium/mra/more_random_connections
Browse files Browse the repository at this point in the history
Up the limit of random connections to gossip
  • Loading branch information
Mark Allen authored Jun 21, 2021
2 parents 0b8f41b + fc28d77 commit a13a084
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/peerbook/libp2p_peer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@ from_map(Map, SigFun) ->
{Type, #libp2p_association_list_pb{associations=AssocEntries}}
end, maps:get(associations, Map, [])),
Connected0 = maps:get(connected, Map, []),
MaxConns = application:get_env(libp2p, max_peers_to_gossip, 8),
Connected =
case length(Connected0) =< MaxConns of
true -> Connected0;
_ -> rand_sub(Connected0, MaxConns)
end,
MaxConns = application:get_env(libp2p, max_peers_to_gossip, 200),
Connected = rand_sub(Connected0, MaxConns),
Peer = #libp2p_peer_pb{pubkey=maps:get(pubkey, Map),
listen_addrs=[multiaddr:new(L) || L <- maps:get(listen_addrs, Map)],
connected = Connected,
Expand Down

0 comments on commit a13a084

Please sign in to comment.