X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Flinux%2Fudptunnel.py;h=63ae086c593752f3a28d779bb19c049363c4bdd6;hb=81eb8370f0689f59aec1c356dae6fed95c9cce68;hp=ae4534d2d13b483ae876e9fc2e99f5a8ed74b953;hpb=afadbc0a4f73d0f53c57bd93767714c12f0c6a5e;p=nepi.git diff --git a/src/nepi/resources/linux/udptunnel.py b/src/nepi/resources/linux/udptunnel.py index ae4534d2..63ae086c 100644 --- a/src/nepi/resources/linux/udptunnel.py +++ b/src/nepi/resources/linux/udptunnel.py @@ -84,7 +84,7 @@ class LinuxUdpTunnel(LinuxTunnel): connected = [] for guid in self.connections: rm = self.ec.get_resource(guid) - if hasattr(rm, "udp_connect_command"): + if hasattr(rm, "udp_connect"): connected.append(rm) return connected @@ -96,43 +96,14 @@ class LinuxUdpTunnel(LinuxTunnel): # Return the command to execute to initiate the connection to the # other endpoint + connection_app_home = self.app_home(endpoint) connection_run_home = self.run_home(endpoint) - udp_connect_command = endpoint.udp_connect_command( - remote_endpoint, connection_run_home, + pid, ppid = endpoint.udp_connect( + remote_endpoint, + connection_app_home, + connection_run_home, cipher, cipher_key, bwlimit, txqueuelen) - # upload command to connect.sh script - shfile = os.path.join(self.app_home(endpoint), "udp-connect.sh") - endpoint.node.upload(udp_connect_command, - shfile, - text = True, - overwrite = False) - - # invoke connect script - cmd = "bash %s" % shfile - (out, err), proc = endpoint.node.run(cmd, self.run_home(endpoint)) - - # check if execution errors occurred - msg = "Failed to connect endpoints " - - if proc.poll(): - self.error(msg, out, err) - raise RuntimeError, msg - - # Wait for pid file to be generated - pid, ppid = endpoint.node.wait_pid(self.run_home(endpoint)) - - # If the process is not running, check for error information - # on the remote machine - if not pid or not ppid: - (out, err), proc = endpoint.node.check_errors(self.run_home(endpoint)) - # Out is what was written in the stderr file - if err: - msg = " Failed to start command '%s' " % command - self.error(msg, out, err) - raise RuntimeError, msg - - # wait until port is written to file port = self.wait_local_port(endpoint) self._pids[endpoint] = (pid, ppid) @@ -228,4 +199,3 @@ class LinuxUdpTunnel(LinuxTunnel): text = True, overwrite = False) -