Ejemplo n.º 1
0
 def do_start_proxy():
     log("do_start_proxy()")
     message_queue = MQueue()
     try:
         ioe = client_proto.wait_for_io_threads_exit(5+self._socket_timeout)
         if not ioe:
             log.error("Error: some network IO threads have failed to terminate")
             return
         client_conn.set_active(True)
         process = ProxyInstanceProcess(uid, gid, env_options, session_options, self._socket_dir,
                                        self.video_encoders, self.csc_modules,
                                        client_conn, disp_desc, client_state, cipher, encryption_key, server_conn, c, message_queue)
         log("starting %s from pid=%s", process, os.getpid())
         self.processes[process] = (display, message_queue)
         process.start()
         log("process started")
         popen = process._popen
         assert popen
         #when this process dies, run reap to update our list of proxy processes:
         self.child_reaper.add_process(popen, "xpra-proxy-%s" % display, "xpra-proxy-instance", True, True, self.reap)
     finally:
         #now we can close our handle on the connection:
         client_conn.close()
         server_conn.close()
         message_queue.put("socket-handover-complete")
Ejemplo n.º 2
0
 def do_start_proxy():
     log("do_start_proxy()")
     message_queue = MQueue()
     try:
         ioe = client_proto.wait_for_io_threads_exit(0.5 + self._socket_timeout)
         if not ioe:
             log.error("some network IO threads have failed to terminate!")
             return
         client_conn.set_active(True)
         assert uid != 0 and gid != 0
         process = ProxyInstanceProcess(
             uid,
             gid,
             env_options,
             session_options,
             self._socket_dir,
             self.video_encoders,
             self.csc_modules,
             client_conn,
             client_state,
             cipher,
             encryption_key,
             server_conn,
             c,
             message_queue,
         )
         log("starting %s from pid=%s", process, os.getpid())
         self.processes[process] = (display, message_queue)
         process.start()
         log("process started")
     finally:
         # now we can close our handle on the connection:
         client_conn.close()
         server_conn.close()
         message_queue.put("socket-handover-complete")
Ejemplo n.º 3
0
 def do_start_proxy():
     log("do_start_proxy()")
     message_queue = MQueue()
     try:
         ioe = client_proto.wait_for_io_threads_exit(5+self._socket_timeout)
         if not ioe:
             log.error("Error: some network IO threads have failed to terminate")
             return
         client_conn.set_active(True)
         process = ProxyInstanceProcess(uid, gid, env_options, session_options, self._socket_dir,
                                        self.video_encoders, self.csc_modules,
                                        client_conn, client_state, cipher, encryption_key, server_conn, c, message_queue)
         log("starting %s from pid=%s", process, os.getpid())
         self.processes[process] = (display, message_queue)
         process.start()
         log("process started")
         popen = process._popen
         assert popen
         #when this process dies, run reap to update our list of proxy processes:
         self.child_reaper.add_process(popen, "xpra-proxy-%s" % display, "xpra-proxy-instance", True, True, self.reap)
     finally:
         #now we can close our handle on the connection:
         client_conn.close()
         server_conn.close()
         message_queue.put("socket-handover-complete")
Ejemplo n.º 4
0
        def start_proxy_process():
            log("start_proxy_process()")
            message_queue = MQueue()
            client_conn = None
            try:
                #no other packets should be arriving until the proxy instance responds to the initial hello packet
                def unexpected_packet(packet):
                    if packet:
                        log.warn("Warning: received an unexpected packet")
                        log.warn(" from the proxy connection %s:",
                                 client_proto)
                        log.warn(" %s", repr_ellipsized(packet))
                        client_proto.close()

                client_conn = client_proto.steal_connection(unexpected_packet)
                client_state = client_proto.save_state()
                log("start_proxy_process(..) client connection=%s",
                    client_conn)
                log("start_proxy_process(..) client state=%s", client_state)

                ioe = client_proto.wait_for_io_threads_exit(
                    5 + self._socket_timeout)
                if not ioe:
                    log.error(
                        "Error: some network IO threads have failed to terminate"
                    )
                    client_proto.close()
                    return
                client_conn.set_active(True)
                from xpra.server.proxy.proxy_instance_process import ProxyInstanceProcess
                process = ProxyInstanceProcess(
                    uid, gid, env_options, session_options, self._socket_dir,
                    self.video_encoders, self.pings, client_conn, disp_desc,
                    client_state, cipher, encryption_key, server_conn, c,
                    message_queue)
                log("starting %s from pid=%s", process, os.getpid())
                self.instances[process] = (True, display, message_queue)
                process.start()
                log("ProxyInstanceProcess started")
                popen = process._popen
                assert popen
                #when this process dies, run reap to update our list of proxy instances:
                self.child_reaper.add_process(popen, "xpra-proxy-%s" % display,
                                              "xpra-proxy-instance", True,
                                              True, self.reap)
            except Exception as e:
                log("start_proxy_process() failed", exc_info=True)
                log.error("Error starting proxy instance process:")
                log.error(" %s", e)
                message_queue.put("error: %s" % e)
                message_queue.put("stop")
            finally:
                #now we can close our handle on the connection:
                log("handover complete: closing connection from proxy server")
                if client_conn:
                    client_conn.close()
                server_conn.close()
                log("sending socket-handover-complete")
                message_queue.put("socket-handover-complete")
Ejemplo n.º 5
0
 def do_start_proxy():
     log("do_start_proxy()")
     message_queue = MQueue()
     try:
         ioe = client_proto.wait_for_io_threads_exit(5+self._socket_timeout)
         if not ioe:
             log.error("some network IO threads have failed to terminate!")
             return
         client_conn.set_active(True)
         assert uid!=0 and gid!=0
         process = ProxyInstanceProcess(uid, gid, env_options, session_options, self._socket_dir,
                                        self.video_encoders, self.csc_modules,
                                        client_conn, client_state, cipher, encryption_key, server_conn, c, message_queue)
         log("starting %s from pid=%s", process, os.getpid())
         self.processes[process] = (display, message_queue)
         process.start()
         log("process started")
     finally:
         #now we can close our handle on the connection:
         client_conn.close()
         server_conn.close()
         message_queue.put("socket-handover-complete")