summaryrefslogtreecommitdiffstats
path: root/client/engine/Protocol.lib
diff options
context:
space:
mode:
Diffstat (limited to 'client/engine/Protocol.lib')
-rwxr-xr-xclient/engine/Protocol.lib25
1 files changed, 8 insertions, 17 deletions
diff --git a/client/engine/Protocol.lib b/client/engine/Protocol.lib
index 5fe2bc74..102ed1c7 100755
--- a/client/engine/Protocol.lib
+++ b/client/engine/Protocol.lib
@@ -382,14 +382,14 @@ OIFS=$IFS; IFS=':' ; SESSION=($2); IFS=$OIFS
#controlamos el PORTBASE de la sesion. Comun.-
PORTBASE=${SESSION[0]}
-ogCheckStringInGroup ${SESSION[0]} "9000 9002 9004 9006 9008 9010" || ogRaiseError $OG_ERR_FORMAT "McastSession portbase ${SESSION[0]}" || PERROR=3 #return $?
+ogCheckStringInGroup ${SESSION[0]} "$(seq 9000 2 9050)" || ogRaiseError $OG_ERR_FORMAT "McastSession portbase ${SESSION[0]}" || PERROR=3 #return $?
if [ $MODE == "server" ]
then
ogCheckStringInGroup ${SESSION[1]} "full-duplex FULL-DUPLEX half-duplex HALF-DUPLEX broadcast BROADCAST" || ogRaiseError $OG_ERR_FORMAT "McastSession method ${SESSION[1]}" || PERROR=4 #return $?
METHOD=${SESSION[1]}
ogCheckIpAddress ${SESSION[2]} || ogRaiseError $OG_ERR_FORMAT "McastSession address ${SESSION[2]}" || PERROR=5 #return $?
ADDRESS=${SESSION[2]}
- ogCheckStringInReg ${SESSION[3]} "^[0-9]{1,2}\M$" || ogRaiseError $OG_ERR_FORMAT "McastSession bitrate ${SESSION[3]}" || PERROR=6 # return $?
+ ogCheckStringInReg ${SESSION[3]} "^[0-9]{1,3}\M$" || ogRaiseError $OG_ERR_FORMAT "McastSession bitrate ${SESSION[3]}" || PERROR=6 # return $?
BITRATE=${SESSION[3]}
ogCheckStringInReg ${SESSION[4]} "^[0-9]{1,10}$" || ogRaiseError $OG_ERR_FORMAT "McastSession nclients ${SESSION[4]}" || PERROR=7 # return $?
NCLIENTS=${SESSION[4]}
@@ -846,11 +846,11 @@ then
case "$MODE" in
peer|PEER)
echo "Donwloading Torrent as peer" ### echo "ctorrent -X 'sleep $TIME; kill -9 \$(pidof ctorrent)' -C 100 $SOURCE -s $TARGET -b ${SOURCE}.bf"
- ctorrent -f -X "sleep 15; kill -2 \$(pidof ctorrent)" -C 100 ${SOURCE} -s ${TARGET} -b ${SOURCE}.bf
+ ctorrent -f -X "sleep $TIME; kill -2 \$(pidof ctorrent)" -C 100 ${SOURCE} -s ${TARGET} -b ${SOURCE}.bf
;;
leecher|LEECHER)
- echo "Donwloading Torrent as leecher" # echo "ctorrent ${SOURCE} -X 'sleep $TIME; kill -9 \$(pidof ctorrent)' -C 100 -U 0"
- ctorrent ${SOURCE} -X "sleep $TIME; kill -2 \$(pidof ctorrent)" -C 100 -U 0
+ echo "Donwloading Torrent as leecher" # echo "ctorrent ${SOURCE} -X 'sleep 30; kill -9 \$(pidof ctorrent)' -C 100 -U 0"
+ ctorrent ${SOURCE} -X "sleep 30; kill -2 \$(pidof ctorrent)" -C 100 -U 0
;;
seeder|SEEDER)
echo "MODE seeder ctorrent" #### ${SOURCE} -X 'sleep $TIME; kill -9 \$(pidof ctorrent)' -C 100"
@@ -998,21 +998,12 @@ fi
#echo "paso 4. recuperamos o calculamos los md5 de los ficheros"
if [ -f $FILESOURCE.sum ]
then
- # echo "leyendo el sum del fichero sum del repo"
MD5SOURCE=$(cat $FILESOURCE.sum)
else
- # echo "calculando el sun del repo"
- MD5SOURCE=$(md5sum $FILESOURCE | cut -f1 -d" ")
-fi
-if [ -f $FILETARGET.sum ]
-then
- #echo "leyendo el sum de la cache"
- MD5TARGET=$(cat $FILETARGET.sum)
-else
- #echo "calculando el sum de la cache"
- md5sum $FILETARGET | cut -f1 -d" " > $FILETARGET.sum
- MD5TARGET=$(cat $FILETARGET.sum)
+ MD5SOURCE=$(ogCalculateChecksum $FILESOURCE)
fi
+[ ! -f $FILETARGET.sum ] && ogCalculateChecksum $FILETARGET > $FILETARGET.sum
+MD5TARGET=$(cat $FILETARGET.sum)
#echo "Paso 5. comparamos los md5"
#TODO: que hacer cuando los md5 son distintos. Por defecto borrar.