amended check for existing nodes

master
KatolaZ 6 years ago
parent 06eee07065
commit 040ba18f7f
  1. 13
      burrow

@ -43,7 +43,7 @@ retrieve_selector(){
SEL=$(echo "$1" | cut -d "|" -f 2)
HOST=$(echo "$1" | cut -d "|" -f 3)
PORT=$(echo "$1" | cut -d "|" -f 4)
printf "${SEL}\r\n" | netcat -w 15 "${HOST}" "${PORT}"
printf "${SEL}\r\n" | netcat -w 5 "${HOST}" "${PORT}"
}
@ -56,7 +56,16 @@ retrieve_selector(){
check_selector_present(){
sel_id="$1"
sel_dir="$(echo ${sel_id} | cut -c -2)"
[ -d "${sel_dir}" -a -f "${sel_dir}/${sel_id}" ] && cat ${sel_dir}/${sel_id} && echo ${sel_id}>>present && exit 1
[ -d "${sel_dir}" -a -f "${sel_dir}/${sel_id}" ] && exit
## {
## if at least one of the neighbours of sel_id is missing, cat the entire list of
## neighbours to be re-visited and exit
## for i in $(cat ${sel_dir}/${sel_id}); do
## i_dir="$(echo ${i} | cut -c -2)"
## [ ! -f ${i_dir}/${i} ] && cat "${sel_dir}/${sel_id}" && break
## done
## exit
## }
[ ! -d "${sel_dir}" ] && mkdir -p "${sel_dir}"
}

Loading…
Cancel
Save