Exemplo n.º 1
0
 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
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
 def register_self(self):
     server_id = ftcon.global_config["server_id"]
     message = agentmsg.packstr(server_id, '', '', '', '',
                                '{"cmd":"register_self"}')
     self.transport.write(message)
Exemplo n.º 9
0
 def register_self(self):
     server_id = ftcon.global_config["server_id"]
     message = agentmsg.packstr(server_id, '', '', '', '', '{"cmd":"register_self"}')
     self.transport.write(message)