Exemplo n.º 1
0
 def __init__(self, sock, addr):
     Endpoint.__init__(self, sock, addr)
     Greenlet.__init__(self)
     self.gdqueue = deque(maxlen=100000)
     self.gdevent = Event()
     self.ctlcmds = Queue(0)
     self.userid = 0
Exemplo n.º 2
0
 def __init__(self, sock, addr):
     Endpoint.__init__(self, sock, addr)
     Greenlet.__init__(self)
     self.observers = BatchList()
     self.init_gamedata_mixin()
     self.gdhistory = []
     self.usergdhistory = []
Exemplo n.º 3
0
 def __init__(self, sock, addr):
     Endpoint.__init__(self, sock, addr)
     Greenlet.__init__(self)
     self.observers = BatchList()
     self.init_gamedata_mixin()
     self.gdhistory = []
     self.usergdhistory = []
Exemplo n.º 4
0
 def __init__(self, sock, addr):
     Endpoint.__init__(self, sock, addr)
     Greenlet.__init__(self)
     self.gdqueue = deque(maxlen=100000)
     self.gdevent = Event()
     self.ctlcmds = Queue(0)
     self.userid = 0
Exemplo n.º 5
0
    def __init__(self, sock, addr):
        Endpoint.__init__(self, sock, addr)
        Greenlet.__init__(self)
        self.gdqueue = deque(maxlen=100)
        self.gdevent = Event()
        self.observers = BatchList()

        import socket
        try:
            sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, True)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 30)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, 6)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, 3)
        except:
            pass
Exemplo n.º 6
0
    def __init__(self, sock, addr):
        Endpoint.__init__(self, sock, addr)
        Greenlet.__init__(self)
        self.gdqueue = deque(maxlen=100)
        self.gdevent = Event()
        self.observers = BatchList()

        import socket
        try:
            sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, True)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 30)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, 6)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, 3)
        except:
            pass
Exemplo n.º 7
0
    def publish(self, key, body):
        try:
            self.chan.basic_publish("thb_events", "%s:%s" % ("forum", key), Endpoint.encode(body))

        except:
            logging.error("error publishing", exc_info=True)
            swallow(self.shutdown)()
            self.connect()
Exemplo n.º 8
0
 def __repr__(self):
     acc = self.account
     if not acc:
         return Endpoint.__repr__(self)
     
     return '%s:%s:%s' % (
         self.__class__.__name__,
         self.address[0],
         acc.username.encode('utf-8'),
     )
Exemplo n.º 9
0
 def publish(self, key, body):
     try:
         self.chan.basic_publish(
             'thb_events', '%s:%s' % (options.node, key),
             Endpoint.encode(body),
         )
     except:
         log.error('error publishing', exc_info=True)
         swallow(self.shutdown)()
         self.connect()
Exemplo n.º 10
0
    def __repr__(self):
        acc = self.account
        if not acc:
            return Endpoint.__repr__(self)

        return '%s:%s:%s' % (
            self.__class__.__name__,
            self.address[0],
            acc.username.encode('utf-8'),
        )
Exemplo n.º 11
0
    def publish(self, key, body):
        try:
            self.chan.basic_publish(
                'thb_events', '%s:%s' % ('forum', key),
                Endpoint.encode(body),
            )

        except:
            logging.error('error publishing', exc_info=True)
            swallow(self.shutdown)()
            self.connect()
Exemplo n.º 12
0
 def gwrite(self, tag, data):
     log.debug('GAME_WRITE: %s', repr([tag, data]))
     encoded = Endpoint.encode(data)
     self.gdhistory.append([tag, json.loads(encoded)])
Exemplo n.º 13
0
 def close(self):
     Endpoint.close(self)
     self.kill(EndpointDied)
Exemplo n.º 14
0
 def close(self):
     Endpoint.close(self)
     self.kill(EndpointDied)
Exemplo n.º 15
0
 def gwrite(self, tag, data):
     log.debug('GAME_WRITE: %s', repr([tag, data]))
     encoded = Endpoint.encode(data)
     self.gdhistory.append([tag, json.loads(encoded)])
Exemplo n.º 16
0
 def publish(self, topic, data):
     self.pub.publish(
         'thb.{}.{}'.format(self.node, topic),
         Endpoint.encode(data),
     )
Exemplo n.º 17
0
 def __init__(self, sock, addr):
     Endpoint.__init__(self, sock, addr)
     Greenlet.__init__(self)
     self.ctlcmds = Queue(0)
     self.userid = 0
     self.init_gamedata_mixin()
Exemplo n.º 18
0
 def __init__(self, sock, addr):
     Endpoint.__init__(self, sock, addr)
     Greenlet.__init__(self)
     self.ctlcmds = Queue(0)
     self.userid = 0
     self.init_gamedata_mixin()