def query(self, src, dst, userheader1, userheader2, data, timeout, notimeoutex=0): try: if self.transport: global _QUERY_ID resultDeferred = defer.Deferred() _QUERY_ID += 1 query_id = src + '.' + str(_QUERY_ID) msg = agentmsg.packstr(src, dst, query_id, userheader1, userheader2, data) cancelCall = reactor.callLater(timeout, self._clearFailed, resultDeferred, query_id, msg, notimeoutex) _LIVE_MESSAGES[query_id] = (resultDeferred, cancelCall, time()) if performance.PERFORMANCE_NET: msg = performance.linkMsgTime('LW', msg) ftlog.debug('transport.write', msg) self.transport.write(msg) return resultDeferred else: ftlog.error('tcpquery : not connected !! ', self) except FTMsgPackException, e: raise e
def send(dst, data, userheader1='', userheader2=''): src = ftcon.global_config["server_id"] server_conf = ftcon.getServerConf(src) agent_id = server_conf['agent'] message = agentmsg.packstr(src, dst, '', userheader1, userheader2, data) protocol = ftcon.serverid_protocol_map[agent_id] ftlog.debug('transport.write', message) protocol.transport.write(message)
def send(dst, data, userheader1='', userheader2=''): src = ftcon.global_config["server_id"] server_conf = ftcon.getServerConf(src) agent_id = server_conf['agent'] message = agentmsg.packstr(src, dst, '', userheader1, userheader2, data) protocol = ftcon.serverid_protocol_map[agent_id] ftlog.debug('transport.write', message) protocol.transport.write(message)
def send(dst, data, userheader1='', userheader2=''): src = ftcon.global_config["server_id"] server_conf = ftcon.getServerConf(src) agent_id = server_conf['agent'] if ide_debug(): ide_print_pack("Send_[%s]" % dst.split("-")[0], json.loads(data)) message = agentmsg.packstr(src, dst, '', userheader1, userheader2, data) protocol = ftcon.serverid_protocol_map[agent_id] ftlog.debug('transport.write', message) protocol.transport.write(message)
def _response(dst, data, queryid, userheader1, userheader2): src = ftcon.global_config["server_id"] server_conf = ftcon.getServerConf(src) if 'agent' in server_conf: agent_id = server_conf['agent'] else: agent_id = dst if dst in ftcon.serverid_protocol_map: agent_id = dst else: server_conf = ftcon.getServerConf(dst) if 'agent' in server_conf: agent_id = server_conf['agent'] message = agentmsg.packstr(src, dst, queryid, userheader1, userheader2, data) ftlog.debug('transport.write', message) protocol = ftcon.serverid_protocol_map[agent_id] protocol.transport.write(message)
def query(self, src, dst, userheader1, userheader2, data, timeout, notimeoutex=0): try: if self.transport: global _QUERY_ID resultDeferred = defer.Deferred() _QUERY_ID += 1 query_id = src + '.' + str(_QUERY_ID) msg = agentmsg.packstr(src, dst, query_id, userheader1, userheader2, data) cancelCall = reactor.callLater(timeout, self._clearFailed, resultDeferred, query_id, msg, notimeoutex) _LIVE_MESSAGES[query_id] = (resultDeferred, cancelCall, time()) if performance.PERFORMANCE_NET: msg = performance.linkMsgTime('LW', msg) ftlog.debug('transport.write', msg) self.transport.write(msg) return resultDeferred else: ftlog.error('tcpquery : not connected !! ', self) except FTMsgPackException, e: raise e
def _response(dst, data, queryid, userheader1, userheader2): src = ftcon.global_config["server_id"] server_conf = ftcon.getServerConf(src) if 'agent' in server_conf: agent_id = server_conf['agent'] else: agent_id = dst if dst in ftcon.serverid_protocol_map: agent_id = dst else: server_conf = ftcon.getServerConf(dst) if 'agent' in server_conf: agent_id = server_conf['agent'] message = agentmsg.packstr(src, dst, queryid, userheader1, userheader2, data) protocol = ftcon.serverid_protocol_map[agent_id] if performance.PERFORMANCE_NET: message = performance.linkMsgTime('LW', message) ftlog.debug('transport.write', message) if ide_debug(): ide_print_pack("Resp [%5s]" % dst.split("-")[0], data) protocol.transport.write(message)
def register_self(self): server_id = ftcon.global_config["server_id"] message = agentmsg.packstr(server_id, '', '', '', '', '{"cmd":"register_self"}') self.transport.write(message)
def register_self(self): server_id = ftcon.global_config["server_id"] message = agentmsg.packstr(server_id, '', '', '', '', '{"cmd":"register_self"}') self.transport.write(message)