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

Up the limit of random connections to gossip #359

Merged
merged 1 commit into from
Jun 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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