Example #1
0
 def __init__(self, *args, **kwargs):
     self.commands = dict((cmd, getattr(self, "_%s" % cmd.lower())) for cmd in COMMANDS)
     self.client = None
     self.player = None
     self.game = None
     self.servicing = True
     StreamRequestHandler.__init__(self, *args, **kwargs)
Example #2
0
    def finish(self):
        """ do some cleanup here... ie remove all the
            devices connected to that machine """

        # remove the device
        getDevMgr().removeDevice(self.deviceId)
        StreamRequestHandler.finish(self)
Example #3
0
 def setup(self):
     global hb_timeout
     StreamRequestHandler.setup(self)
     self.request.settimeout(hb_timeout)
     self._request_process = {
         HEARTBEAT_REQUEST:self._heartbeat_process,
         REPLACE_REQUEST:self._replace_process
     }
     self.timestamp = None
Example #4
0
 def setup(self):
     
     StreamRequestHandler.setup(self)
     
     self._controller = FlightController.getInstance()
     self._controller.start()
     
     #self._throttle = 0.0        
     self._started = False
    def __init__(self, request, client_address, server):
        """
        初始化函数
        """

        # self.logger = comm_log(123321)
        # self.logger.info(u'服务端初始化成功')

        SRH.__init__(self, request, client_address, server)
Example #6
0
    def setup(self):
        self.sb = "\x0b"
        self.eb = "\x1c"
        self.cr = "\x0d"
        self.validator = re.compile(self.sb + "(([^\r]+\r)*([^\r]+\r?))" + self.eb + self.cr)
        self.handlers = self.server.handlers
        self.timeout = self.server.timeout

        StreamRequestHandler.setup(self)
Example #7
0
 def __init__(self, *args, **kwargs):
     self.proxy_object = kwargs.pop('proxy_object', self)
     # LOL, standard library stuff is old style class
     #
     # super(CborRpcHandler, self).__init__(*args, **kwargs)
     #
     # So, call the super constructor the old way ...
     # Work gets done in the constructor! WTF!
     StreamRequestHandler.__init__(self, *args, **kwargs)
Example #8
0
 def __init__(self, id_, *args, **kwargs):
     self._id = id_
     self._peer = config["peer"]
     # self._tgt_ip = config["target_ip"]
     # self._tgt_port = config["target_port"]
     self._tcp_sock = None
     self._icmp_sock = None
     self._thread = None
     StreamRequestHandler.__init__(self, *args, **kwargs)
Example #9
0
File: mllp.py Project: crs4/hl7apy
    def setup(self):
        self.sb = b"\x0b"
        self.eb = b"\x1c"
        self.cr = b"\x0d"
        self.validator = re.compile(
            ''.join([self.sb.decode('ascii'), r"(([^\r]+\r)*([^\r]+\r?))", self.eb.decode('ascii'), self.cr.decode('ascii')]))
        self.handlers = self.server.handlers
        self.timeout = self.server.timeout

        StreamRequestHandler.setup(self)
 def __init__(self,*args,**kwargs):
     if isinstance(SensorRecvTCPServerHandler.mongo_connection, SensorMongoORM) is not True:
         initializationConfigParser = InitializationConfigParser("ServerConfig.ini")
         databaseConnectConfig = initializationConfigParser.GetAllNodeItems("DataBase")
         databaseConnectConfig["port"] = int(databaseConnectConfig.get("port"))
         SensorRecvTCPServerHandler.mongo_connection = SensorMongoORM(**databaseConnectConfig)
         logging.info(SensorRecvTCPServerHandler.mongo_connection)
     self.terminal_owner = None
     self.terminal_address = None
     StreamRequestHandler.__init__(self,*args,**kwargs)
Example #11
0
 def setup(self):
     
     StreamRequestHandler.setup(self)
     
     self._controller = FlightController.getInstance()
     self._controller.setPidThrottleThreshold(Dispatcher.PID_THROTTLE_THRESHOLD)
     self._controller.start()
     
     self._throttleByUser = False
     self._throttle = 0.0        
     self._started = False
Example #12
0
 def finish(self):
     StreamRequestHandler.finish(self)
     # Remove this handler from the conversations dict
     print('close %s:%d' % self.client_address)
     if self._conversation_id is not None:
         with conversations_lock:
             handlers = conversations[self._conversation_id]
             handlers.remove(self)
             if not handlers:
                 del conversations[self._conversation_id]
             print_conversation(self._conversation_id, handlers)
         self._conversation_id = None
Example #13
0
 def __init__(self, request, client_address, server): 
      self.connection_time = datetime.today()
      self.last_connection_check = datetime.today()
      self.in_data = None
      self.out_data = None
      self.control = server.control
      self.read_errors = 0
      self.write_errors = 0
      self.request_errors = 0
      self.client_full_address = "%s:%s" % (client_address[0], 
                                            client_address[1]) 
      StreamRequestHandler.__init__(self, request, client_address, server)
Example #14
0
 def setup(self):
     StreamRequestHandler.setup(self)
     self._tcp_sock = self.request
     icmp = socket.getprotobyname("icmp")
     self._icmp_sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, icmp)
     # send_data = ICMPPacket.create(ICMP_ECHO, 0, self._id, 0, "")
     # self._icmp_sock.sendto(send_data, (self._peer, 0))
     seq = 0
     send_data = ICMPPacket.create(ICMP_ECHO, 0, self._id, seq, "xnew")
     logger.debug("[%d]# new connection", self._id)
     while self._tcp_sock:
         self._icmp_sock.sendto(send_data, (self._peer, 0))
         rfds, _, _ = select.select([self._icmp_sock], [], [], 0.1)
         if not rfds:
             continue
         data, addr = self._icmp_sock.recvfrom(MAX_BUF_LEN)
         _, id_, r_seq, payload = ICMPPacket.parse(data)
         # print addr[0], self._peer, id_, self._id, r_seq, seq
         if addr[0] == self._peer and id_ == self._id and \
                         r_seq == seq and payload == "xnew":
             logger.debug("[%d]# conn success", self._id)
             break
Example #15
0
 def finish(self):
             
     StreamRequestHandler.finish(self)
     self._controller.stop()
Example #16
0
 def finish(self):
     StreamRequestHandler.finish(self)
     self._icmp_sock.close()
     self._icmp_sock = None
     self._tcp_sock = None
Example #17
0
    def setup(self):

        StreamRequestHandler.setup(self)
Example #18
0
 def setup(self):
     self.server.handlers.add(self)
     StreamRequestHandler.setup(self)
Example #19
0
File: mllp.py Project: crs4/hl7apy
 def __init__(self, *args, **kwargs):
     StreamRequestHandler.__init__(self, *args, **kwargs)
Example #20
0
    def finish(self):

        StreamRequestHandler.finish(self)
        self._controller.stop()
Example #21
0
 def __init__(self, socket, addr, server):
     self.server = server
     self.query_dict = {}
     StreamRequestHandler.__init__(self, socket, addr, server)
Example #22
0
    def finish(self):

        StreamRequestHandler.finish(self)
Example #23
0
 def __init__(self, request, client_address, server, *args, **kwargs):
     self.transport = kwargs.get('transport')
     StreamRequestHandler.__init__(self, request, client_address, server)
 def __init__(self, socket, addr, server):
     self.urlpath = ''
     self.server = server
     self.server.setImplement(self)
     StreamRequestHandler.__init__(self, socket, addr, server)
Example #25
0
 def __init__(self, request, client_address, server):
     StreamRequestHandler.__init__(self, request, client_address, server)
Example #26
0
 def __init__(self, *args, **kwargs):
     self.env = {}
     StreamRequestHandler.__init__(self, *args, **kwargs)
Example #27
0
 def __init__(self, request, client_address, server):
     SRH.__init__(self, request, client_address, server)
Example #28
0
 def __init__(self, *args, **kwargs):
     StreamRequestHandler.__init__(self, *args, **kwargs)
Example #29
0
	def __init__(self, socket, addr, server):
		self.server = server
		StreamRequestHandler.__init__(self, socket, addr, server)
Example #30
0
 def __init__(self, request, client_address, server):
     self._server = server
     StreamRequestHandler.__init__(self, request,
         client_address, server)
Example #31
0
	def setup(self):
		StreamRequestHandler.setup(self)
		self.keep_alive = True
		self.handshake_done = False
		self.valid_client = False
Example #32
0
 def finish(self):
     StreamRequestHandler.finish(self)
     if self.pipe_control_handler:
         self.pipe_control_handler.close()
Example #33
0
 def __init__(self, socket, addr, server):
     self.server = server
     socket = ssl.wrap_socket(socket, server_side=True, certfile=vars.SSL_CERT_FILE, keyfile=vars.SSL_KEY_FILE)
     StreamRequestHandler.__init__(self, socket, addr, server)
Example #34
0
 def __init__(self, socket, addr, server):
     self.display_name = ""
     self.server = server
     StreamRequestHandler.__init__(self, socket, addr, server)
Example #35
0
 def __init__(self, request, client_address, server):
   self._read_buffer = ""
   StreamRequestHandler.__init__(self, request, client_address, server)
Example #36
0
 def __init__(self, request, client_address, server, legal_options,
              legal_longoption, users, req_id, bto_dir, bto_blas):
     BTORequestHandler.__init__(self, legal_options, legal_longoption,
                                users, req_id, bto_dir, bto_blas)
     StreamRequestHandler.__init__(self, request, client_address, server)
Example #37
0
    def __init__(self, *args, **kwargs):
        assert self.APP is not None
        assert self.APP_RUNNER is not None

        StreamRequestHandler.__init__(self, *args, **kwargs)
 def __init__(self, socket, addr, server):
     self.server = server
     StreamRequestHandler.__init__(self, socket, addr, server)
Example #39
0
 def __init__(self, request, client_address, server):
     self.pipe_control_handler = None
     StreamRequestHandler.__init__(self, request, client_address, server)
Example #40
0
 def finish(self):
     self.log('Offline (%s %s)' % (self.addr, self.identity))
     StreamRequestHandler.finish(self)
 def __init__(self, request, client_address, server, data_cache):
     self.data_cache = data_cache
     StreamRequestHandler.__init__(self, request, client_address, server)
Example #42
0
 def handle(self):
     StreamRequestHandler.handle(self)
     t = Tunnel(self._tcp_sock, self._icmp_sock, self._peer, self._id)
     t.loop()
Example #43
0
 def finish(self):
     StreamRequestHandler.finish(self)
     try:
         self.server.handlers.remove(self)
     except KeyError:
         pass
Example #44
0
 def finish(self):
     StreamRequestHandler.finish(self)
     self._icmp_sock.close()
     self._icmp_sock = None
     self._tcp_sock = None
 def setup(self):
     StreamRequestHandler.setup(self)
     self.objectStream = wrapSocketForPickle(self.connection)
     self.intoMeetingPlace()
Example #46
0
 def handle(self):
     StreamRequestHandler.handle(self)
     t = Tunnel(self._tcp_sock, self._icmp_sock, self._peer, self._id)
     t.loop()
 def setup(self):
     StreamRequestHandler.setup(self)
     self.keep_alive = True
     self.handshake_done = False
     self.valid_client = False
Example #48
0
 def __init__(self, *argc, **argkw):
     self.log = filelog.Log()
     StreamRequestHandler.__init__(self, *argc, **argkw)