]> git.entuzijast.net Git - imunes.git/commitdiff
remote execution code cleanup
authormiljenko <miljenko>
Wed, 21 Dec 2005 07:43:21 +0000 (07:43 +0000)
committermiljenko <miljenko>
Wed, 21 Dec 2005 07:43:21 +0000 (07:43 +0000)
Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

exec.tcl

index e7a67c93c10564dac01ea0e940468f0944e4b69d..a11291273c38cf00eb6e2180ef8013a4e05d9d2e 100755 (executable)
--- a/exec.tcl
+++ b/exec.tcl
@@ -156,15 +156,17 @@ proc open_exec_sockets {} {
         } 
 
         if { [info exists exec_sock] && [info exists monitor_sock] } {
-            for { set i 1 } { $i <= 4 } { incr i } {
-                if {[lindex [fconfigure $exec_sock -sockname] 0] != "0.0.0.0" &&
-                    [lindex [fconfigure $monitor_sock -sockname] 0] != "0.0.0.0" } {
-                   set fail false
-                   break
-               } else {
-                   after 250 ;# Max 2 sec for socket creation
-               }
+          for { set i 1 } { $i <= 4 } { incr i } {
+            if {([lindex [fconfigure $exec_sock -sockname] 0] != "0.0.0.0") &&
+                ([lindex [fconfigure $monitor_sock -sockname] 0] != "0.0.0.0")
+                && ([catch {fconfigure $exec_sock -peername} a] == 0)
+                && ([catch {fconfigure $monitor_sock -peername} a] == 0) } {
+                set fail false
+                break
+            } else {
+                after 250 ;# Max 2 sec for socket creation
             }
+          }
         }
 
         if { $fail } {
@@ -175,6 +177,7 @@ proc open_exec_sockets {} {
                 0 { ;# retry
                   }
                 1 { configRemoteHosts
+                    ;# Never comes back!?
                     set at_least_one_up false
                     set n [llength $exec_hosts]
                     for { set i 0 } { $i < $n } { incr i } {
@@ -188,12 +191,16 @@ proc open_exec_sockets {} {
                     }
                     if { $remote_exec && ! $at_least_one_up } {
                         set editor_only true
-                        .menubat.experiment entryconfigure \
+                        .menubar.experiment entryconfigure \
                              "Execute" -state disabled
                     }
                   }
 
-                2 { set editor_only true; set fail false; return }
+                2 { set editor_only true
+                    .menubar.experiment entryconfigure "Execute" -state disabled
+                    set fail false
+                    return 
+                  }
                 default { }
             }
         }
@@ -507,7 +514,22 @@ proc deployCfg {} {
                close $fileId
             } else {
                nexec nc -l -p 1235 > /tmp/$node_id/boot.conf &
-                set s [socket $exec_host 1235]
+                ;# set s [socket $exec_host 1235]
+                catch {set s [socket -async $exec_host 1235]}
+                set fail true
+                for { set i 1 } { $i <= 4 } { incr i } {
+                    if {[catch {fconfigure $s -peername} a] == 0 } {
+                        set fail false
+                        break
+                    } else { 
+                        after 250 ;# Max 2 sec for socket creation
+                    }
+                }
+                if { $fail } {
+                    tk_messageBox -title "Boot file creation" \
+                        -message "Cannot open socket: $exec_host:1235 for boot file creation. \nPlease report this problem." -type ok
+                    exit 5
+                }
                 fconfigure $s -buffering line -translation lf
                 foreach line $bootcfg {
                    puts $s $line
@@ -515,7 +537,8 @@ proc deployCfg {} {
                flush $s
                 close $s
             }
-            catch "nexec vimage $node_id $bootcmd /tmp/$node_id/boot.conf &"
+            ;# removed backgroud invocation
+            catch "nexec vimage $node_id $bootcmd /tmp/$node_id/boot.conf"
        }
     }