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
def __init__(self, sock, addr): Endpoint.__init__(self, sock, addr) Greenlet.__init__(self) self.observers = BatchList() self.init_gamedata_mixin() self.gdhistory = [] self.usergdhistory = []
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
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()
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'), )
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()
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()
def gwrite(self, tag, data): log.debug('GAME_WRITE: %s', repr([tag, data])) encoded = Endpoint.encode(data) self.gdhistory.append([tag, json.loads(encoded)])
def close(self): Endpoint.close(self) self.kill(EndpointDied)
def publish(self, topic, data): self.pub.publish( 'thb.{}.{}'.format(self.node, topic), Endpoint.encode(data), )
def __init__(self, sock, addr): Endpoint.__init__(self, sock, addr) Greenlet.__init__(self) self.ctlcmds = Queue(0) self.userid = 0 self.init_gamedata_mixin()