]> git.entuzijast.net Git - imunes.git/commitdiff
Active remote host selection
authormiljenko <miljenko>
Thu, 8 Dec 2005 10:25:12 +0000 (10:25 +0000)
committermiljenko <miljenko>
Thu, 8 Dec 2005 10:25:12 +0000 (10:25 +0000)
Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

exec.tcl

index d1387852b0bd5eb4a2abecb10dd5a2dda3264fc5..921377f1fb7eca116bdfe22523d19f2868863787 100755 (executable)
--- 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 { }
             }