From e2dea7e5af58490011f2c8b3033a27494ac09219 Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 11 Sep 2021 01:44:15 +0200 Subject: [PATCH] peering peers only the one who sync --- zen/ipfs_SWARM_refresh.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/zen/ipfs_SWARM_refresh.sh b/zen/ipfs_SWARM_refresh.sh index 69d7c9b..26bd907 100755 --- a/zen/ipfs_SWARM_refresh.sh +++ b/zen/ipfs_SWARM_refresh.sh @@ -114,17 +114,6 @@ do fi fi ################################################################ - echo "@@ CREATING Peering.Peer @@" - echo "jq '.Peering.Peers? += { \"Addrs\": [], \"ID\": \"'$ipfsnodeid'\" }'" - ################################################################ - Addr=$(echo "$peerline" | rev | cut -d '/' -f 2- | rev ) - IsAlreadythere=$(cat ~/.ipfs/config.new | grep '"$ipfsnodeid"') && echo $IsAlreadythere - if [[ ! $IsAlreadythere ]]; then - echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt - #jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new - jq '.Peering.Peers[.Peering.Peers| length] |= . + { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new - fi - ################################################################ ## Refresh bootstrap if XID exists [[ "$XID" != "" ]] && ipfs bootstrap rm "/ipfs/$ipfsnodeid" && ipfs bootstrap add "$peerline" || ipfs bootstrap rm "$peerline" ################################################################ @@ -138,6 +127,17 @@ do then echo "TIMEOUT REACHED ___ SHOULD I REMOVE $ipfsnodeid FROM ~/.zen/A_my_swarm.txt? DO NOTHING"; else + ################################################################ + echo "@@ CREATING Peering.Peer @@" + echo "jq '.Peering.Peers? += { \"Addrs\": [], \"ID\": \"'$ipfsnodeid'\" }'" + ################################################################ + Addr=$(echo "$peerline" | rev | cut -d '/' -f 2- | rev ) + IsAlreadythere=$(cat ~/.ipfs/config.new | grep '"$ipfsnodeid"') && echo $IsAlreadythere + if [[ ! $IsAlreadythere ]]; then + echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt + #jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new + jq '.Peering.Peers[.Peering.Peers| length] |= . + { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new + fi ################################################################ echo "## REFRESH stargates keys from my friend" ################################################################