Ignore:
Timestamp:
Dec 15, 2009, 1:39:04 PM (17 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
bc98cf7
Parents:
e213da6
Message:

fix #812 : ps_runtol tcl client side, RemoteTOL tol cliente side of RUNTOL request

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1810 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tolsh/tolsh.vfs/lib/tolcomm/rmtps_client.tcl

    re213da6 r71d0868  
    1010package provide rmtps_client 1.0
    1111
    12 package require tlogger
     12package require base64
     13
     14if { [ catch { package require tlogger } ] } {
     15  namespace eval tlogger {
     16    variable _level "error"
     17
     18    proc init { svc {logfile ""} } {
     19    }
     20   
     21    proc level { svc l } {
     22      variable _level $l
     23    }
     24
     25    proc log { l msg } {
     26      variable _level
     27
     28      if { $l eq $_level } {
     29        puts $msg
     30      }
     31    }
     32  }
     33}
    1334
    1435###############################################################################
    … …  
    159180}
    160181
     182proc ask_server_channel { chan request } {
     183
     184  usado sobre todo para pedir la razon del fallo
     185
     186  el timeout quizas deba cerrar el channel, esa peticion se cancela
     187
     188  file channels puedo usarlo para verificar si un socket existe.
     189}
     190
    161191###############################################################################
    162192#
    … …  
    270300  # Answer from server must be an integer value
    271301  #
    272   if {$result eq "" || ![string is integer $result]} {
     302  if { $result eq "" || ![string is integer $result] ||
     303      ![string is boolean $result] } {
    273304    set result -1
    274305  } else {
    … …  
    358389}
    359390
     391
     392###############################################################################
     393#
     394#  ps_runtol -- execute a TOL process on a remote host
     395#
     396#   Arguments --
     397#
     398#     host        - computer (remote host) where RmtPS_Server is running
     399#     port        - port where the server socket is listening
     400#     cmdln_args  - TOL arguments
     401#
     402#   Return --
     403#
     404#     PID of the process if cmdline could be executed
     405#     0 if the command line could not be executed
     406#
     407###############################################################################
     408proc ::rmtps_client::ps_runtol { host port cmdln_args } {
     409
     410  log "debug" "enter ps_runtol $host $port $cmdln_args"
     411
     412  # send request to server
     413  #
     414  set cmdln64 [ base64::encode -wrapchar "" $cmdln_args ]
     415  #set cmdln64 $cmdln_args
     416  set result [ask_server $host $port "RUNTOL $cmdln64"]
     417  # Make sure that 0 or PID>0 is returned
     418  #
     419  if {![string is integer $result] || $result<0} {
     420    set result 0
     421  }
     422
     423  log "debug" "leave ps_runtol $host $port $cmdln_args : $result"
     424
     425  set result
     426}
     427
    360428###############################################################################
    361429#
Note: See TracChangeset for help on using the changeset viewer.