From 3f64b65f3fea9a00be8f0dd4ad60c7fed859b8ee Mon Sep 17 00:00:00 2001 From: qo-op Date: Fri, 4 Jun 2021 05:59:48 +0200 Subject: [PATCH] better, faster, stronger --- zen/gchange_IPFS_swarm.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zen/gchange_IPFS_swarm.sh b/zen/gchange_IPFS_swarm.sh index b6cf9a5..d4ef699 100755 --- a/zen/gchange_IPFS_swarm.sh +++ b/zen/gchange_IPFS_swarm.sh @@ -21,6 +21,7 @@ fi # Force Strict #swarm0 !!? rm -f /tmp/ipfstryme.* rm -f ~/.zen/A_Qm_swarm.txt + liking_me_count=0 friend_of_mine_count=0 echo $(date) @@ -41,15 +42,19 @@ do ## Get "/tmp/ipfstryme.$liking_me" from Gchange "ipfstryme" message ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" read -n300 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content' > /tmp/ipfstryme.$liking_me + ## ZOMBIE NODE sends more that 300 ipfstryme ? + ## [[ $(cat /tmp/ipfstryme.$liking_me | sort | uniq | wc -l) -gt 300 ]] && echo "THIS NODE IS A ZOMBIE..." && rm -f /tmp/ipfstryme.$liking_me && continue + # CLEAN /tmp/ipfstryme.$liking_me + > /tmp/ipfstryme.clean for line in $(cat /tmp/ipfstryme.$liking_me); do [[ $line == "" ]] && break - echo $line >> /tmp/ipfstryme.clean + ipfsnodeid=$(echo $line | rev | cut -d '/' -f 1 | rev) + [[ ! $(cat /tmp/ipfstryme.clean | grep $ipfsnodeid) ]] && echo $line >> /tmp/ipfstryme.clean done + cat /tmp/ipfstryme.clean | sort | uniq > /tmp/ipfstryme.$liking_me - ## ZOMBIE NODE sends more that 300 ipfstryme ? - [[ $(cat /tmp/ipfstryme.$liking_me | sort | uniq | wc -l) -gt 300 ]] && echo "THIS NODE IS A ZOMBIE..." && rm -f /tmp/ipfstryme.$liking_me && continue cat /tmp/ipfstryme.$liking_me echo "__________________________________________" done