From: miljenko Date: Thu, 8 Dec 2005 10:25:12 +0000 (+0000) Subject: Active remote host selection X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=92370956932a32e7ab17bebce518f32580282c4f;p=imunes.git Active remote host selection Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- diff --git a/exec.tcl b/exec.tcl index d138785..921377f 100755 --- a/exec.tcl +++ b/exec.tcl @@ -122,10 +122,19 @@ proc open_exec_sockets {} { if { ! $remote_exec } { return } - set exec_host [lindex [lindex $exec_hosts 0] 0] - set exec_port [lindex [lindex $exec_hosts 0] 1] - set monitor_port [lindex [lindex $exec_hosts 0] 2] + set remote_exec false + set n [llength $exec_hosts] + for { set i 0 } { $i < $n } { incr i } { + if { [lindex [lindex $exec_hosts $i] 3] } { + set exec_host [lindex [lindex $exec_hosts $i] 0] + set exec_port [lindex [lindex $exec_hosts $i] 1] + set monitor_port [lindex [lindex $exec_hosts $i] 2] + set remote_exec true + break + } + } + if { ! $remote_exec } { return } set exec_sock [socket -async $exec_host $exec_port] set monitor_sock [socket -async $exec_host $monitor_port] @@ -148,11 +157,29 @@ proc open_exec_sockets {} { "" 0 "Retry" "Configure remote hosts" "Editor only mode" ] switch $sel { 1 { configRemoteHosts - set exec_host [lindex [lindex $exec_hosts 0] 0] - set exec_port [lindex [lindex $exec_hosts 0] 1] - set monitor_port [lindex [lindex $exec_hosts 0] 2] - set exec_sock [socket -async $exec_host $exec_port] - set monitor_sock [socket -async $exec_host $monitor_port] } + set at_least_one_up false + set n [llength $exec_hosts] + for { set i 0 } { $i < $n } { incr i } { + if { [lindex [lindex $exec_hosts $i] 3] } { + set exec_host [lindex [lindex $exec_hosts $i] 0] + set exec_port [lindex [lindex $exec_hosts $i] 1] + set monitor_port [lindex [lindex $exec_hosts $i] 2] + set at_least_one_up true + break + } + } + if { $remote_exec && ! $at_least_one_up } { + set editor_only true + .menubat.experiment entryconfigure \ + "Execute" -state disabled + } else { + set exec_sock + [socket -async $exec_host $exec_port] + set monitor_sock + [socket -async $exec_host $monitor_port] + } + } + 2 { set editor_only true; set fail false; return } default { } }