ControlScripts: add hrktorrent client-based limitation options to client_script_mappings
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Mon, 9 Aug 2010 16:31:49 +0000 (19:31 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Mon, 9 Aug 2010 16:34:33 +0000 (19:34 +0300)
ControlScripts/client_script_mappings

index 64367cd..ee00b37 100644 (file)
@@ -13,6 +13,11 @@ DEBUG()
 start_client()
 {
        local client_type=$1
+       local download_limit=$2
+       local upload_limit=$3
+
+       download_limit=$(($download_limit * 1024 / 8))
+       upload_limit=$(($upload_limit * 1024 / 8))
 
        DEBUG echo "starting client ..."
        case "${client_type}" in
@@ -24,6 +29,14 @@ start_client()
                        clients/hrk/start_hrk_leecher.sh &
                        return $!
                        ;;
+               "hrktorrent_seeder_limit")
+                       clients/hrk/start_hrk_seeder_limit.sh ${download_limit} ${upload_limit} &
+                       return $!
+                       ;;
+               "hrktorrent_leecher_limit")
+                       clients/hrk/start_hrk_leecher_limit.sh ${download_limit} ${upload_limit} &
+                       return $!
+                       ;;
                "tribler_seeder")
                        clients/tribler/start_tribler_seeder.sh &
                        return $!
@@ -61,10 +74,7 @@ stop_client()
 
        DEBUG echo "stopping client ..."
        case "${CLIENT_TYPE}" in
-               "hrktorrent_seeder")
-                       clients/hrk/stop_hrk.sh
-                       ;;
-               "hrktorrent_leecher")
+               "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
                        clients/hrk/stop_hrk.sh
                        ;;
                "tribler_seeder")
@@ -98,10 +108,7 @@ detect_complete_client()
 
        DEBUG echo "stopping client ..."
        case "${client_type}" in
-               "hrktorrent_seeder")
-                       clients/hrk/detect_complete_hrk.sh ${log_file}
-                       ;;
-               "hrktorrent_leecher")
+               "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
                        clients/hrk/detect_complete_hrk.sh ${log_file}
                        ;;
                "tribler_seeder")
@@ -136,14 +143,10 @@ parse_client_log()
 
        DEBUG echo "parsing client ${client_type} (${log_folder}/${log_file})..."
        case "${client_type}" in
-               "hrktorrent_seeder")
+               "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
                        DEBUG echo "hello hrktorrent_seeder"
                        clients/hrk/parse_hrk.sh ${log_folder} ${log_file}
                        ;;
-               "hrktorrent_leecher")
-                       DEBUG echo "hello hrktorrent_leecher"
-                       clients/hrk/parse_hrk.sh ${log_folder} ${log_file}
-                       ;;
                "tribler_seeder")
                        clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
                        ;;