Exemple #1
0
 def handle_socket(self, **args):
     sock = create_socket(**args)
     status = tradesocket.send_fd( self._unix_socket.fileno(), sock.fileno())
     if (status < 0):
         raise RuntimeError("Send error, status: %r" % status)
     self._pipe.send(True)
     sock.close()    # We don't need this anymore, discard.
 def handle_request(self, request):
     if request.type == 'socket':
         sock = self.create_socket(**request.data)
         status = tradesocket.send_fd( self._unix_socket.fileno(), sock.fileno())
         if (status < 0):
             raise RuntimeError("Send error, status: %r" % status)
         self._pipe.send(True)
         self.close_socket(sock)
     elif request.type == 'exit':
         self._pipe.send(True)
         sys.exit(request.data.get('code', 0))
     else:
         raise RuntimeError("Invalid Baron request: %r" % request)