示例#1
0
 def connectionMade(self):
     "connectionMade"
     if self.factory.delays_enable:
         self._lagmax = ABSOLUTE_LAGMAX
         self.lag = self.factory.delays.get("lag", DEFAULT_LAGMAX)
     self.no_display_packets = self.factory.no_display_packets
     UGAMEClientProtocol.connectionMade(self)
示例#2
0
 def connectionLost(self, reason):
     if self.factory.crashing:
         self.log.warn("connectionLost: crashing, just return.")
         return
     self.log.warn("connectionLost: noticed, aborting all tables.")
     self.abortAllTables()
     UGAMEClientProtocol.connectionLost(self, reason)
示例#3
0
 def connectionLost(self, reason):
     if self.factory.crashing:
         self.log.warn("connectionLost: crashing, just return.")
         return
     self.log.warn("connectionLost: noticed, aborting all tables.")
     self.abortAllTables()
     UGAMEClientProtocol.connectionLost(self, reason)
示例#4
0
 def connectionMade(self):
     "connectionMade"
     if self.factory.delays_enable:
         self._lagmax = ABSOLUTE_LAGMAX
         self.lag = self.factory.delays.get("lag", DEFAULT_LAGMAX)
     self.no_display_packets = self.factory.no_display_packets
     UGAMEClientProtocol.connectionMade(self)
示例#5
0
 def protocolInvalid(self, server, client):
     self.schedulePacket(
         PacketProtocolError(
             message=
             "Upgrade the client from\nhttp://mekensleep.org/\nServer version is %s\nClient version is %s"
             % (server, client)))
     self.publishAllPackets()
     UGAMEClientProtocol.protocolInvalid(self, server, client)
示例#6
0
    def __init__(self, screenObj, msgpokerurl):
        UGAMEClientProtocol.__init__(self)
        self.screenObj = screenObj
        self.screenObj.executeCmd = self.executeCmd
        self.state = STATE_LOGIN
        self.avatar = Player()
        self.table = NoneTable()

        self.game_id = -1
        self.msgpokerurl = msgpokerurl
示例#7
0
    def __init__(self, screenObj, msgpokerurl):
        UGAMEClientProtocol.__init__(self)
        self.screenObj = screenObj
        self.screenObj.executeCmd = self.executeCmd
        self.state = STATE_LOGIN
        self.avatar = Player()
        self.table = NoneTable()

        self.game_id = -1
        self.msgpokerurl = msgpokerurl
示例#8
0
 def protocolEstablished(self):
     self.keepalive_set_interval(self.factory.ping_delay)
     poll_frequency = self.factory.settings.headerGet("/settings/@poll_frequency")
     if poll_frequency:
         self._poll_frequency = float(poll_frequency)
     self.user.name = self.factory.name
     self.user.password = self.factory.password
     self._packet2id = self.packet2id
     self._packet2front = self.packet2front
     self.schedulePacket(PacketBootstrap())
     UGAMEClientProtocol.protocolEstablished(self)
示例#9
0
 def protocolEstablished(self):
     self.setPingDelay(self.factory.ping_delay)
     poll_frequency = self.factory.settings.headerGet("/settings/@poll_frequency")
     if poll_frequency:
         self._poll_frequency = float(poll_frequency)
     self.user.name = self.factory.name
     self.user.password = self.factory.password
     self._packet2id = self.packet2id
     self._packet2front = self.packet2front
     self.schedulePacket(PacketBootstrap())
     UGAMEClientProtocol.protocolEstablished(self)
示例#10
0
    def sendPacket(self, packet):
        try:
            UGAMEClientProtocol.sendPacket(self, packet)
            self.screenObj.addLine("< " + str(packet))
        except Exception:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            self.screenObj.addLine(" EEE  sendPacket failed: " + str(packet))

            for exline in traceback.format_exception(exc_type, exc_value,
                                                     exc_traceback):
                for line in exline.split('\n'):
                    self.screenObj.addLine(" EEE " + str(line))
示例#11
0
    def sendPacket(self, packet):
        try:
            UGAMEClientProtocol.sendPacket(self, packet)
            self.screenObj.addLine("< " + str(packet))
        except Exception:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            self.screenObj.addLine(" EEE  sendPacket failed: " + str(packet))

            for exline in traceback.format_exception(exc_type, exc_value,
                                          exc_traceback):
                for line in exline.split('\n'):
                    self.screenObj.addLine(" EEE " + str(line))
示例#12
0
 def __init__(self):
     UGAMEClientProtocol.__init__(self)
     self.callbacks = {'current': {}, 'not_current': {}, 'outbound': {}}
     self.setCurrentGameId(None)
     self.pending_auth_request = False
     self.publish_packets = []
     self.input_packets = []
     self.publish_timer = None
     self.publish_time = 0
     self.publishPackets()
     self.lag = DEFAULT_LAGMAX
     self.lagmax_callbacks = []
     self.explain = PokerExplain()
示例#13
0
 def __init__(self):
     UGAMEClientProtocol.__init__(self)
     self.callbacks = {
         'current': {},
         'not_current': {},
         'outbound': {}
         }
     self.setCurrentGameId(None)
     self.pending_auth_request = False
     self.publish_packets = []
     self.input_packets = []
     self.publish_timer = None
     self.publish_time = 0
     self.publishPackets()
     self.lag = DEFAULT_LAGMAX
     self.lagmax_callbacks = []
     self.explain = PokerExplain()
示例#14
0
    def sendPacket(self, packet):
        if packet.type == PACKET_POKER_TABLE_QUIT:
            self.scheduleTableAbort(self.getGame(packet.game_id))
        elif packet.type == PACKET_POKER_SIT_OUT:
            game = self.getGame(packet.game_id)
            if game:
                game.sitOutNextTurn(packet.serial)
            self.schedulePacket(PacketPokerSitOutNextTurn(game_id = packet.game_id, serial = packet.serial))
        elif packet.type == PACKET_POKER_SIT:
            game = self.getGame(packet.game_id)
            if game:
                game.sitRequested(packet.serial)
            self.schedulePacket(PacketPokerSitRequest(game_id = packet.game_id, serial = packet.serial))
        elif packet.type == PACKET_QUIT:
            self.abortAllTables()

        UGAMEClientProtocol.sendPacket(self, packet)
示例#15
0
 def __init__(self):
     UGAMEClientProtocol.__init__(self)
     self.log = PokerClientProtocol.log.get_instance(
         self,
         refs=[('User', self, lambda client: client.user.serial
                if client.user else None)])
     self.callbacks = {'current': {}, 'not_current': {}, 'outbound': {}}
     self.setCurrentGameId(None)
     self.pending_auth_request = False
     self.publish_packets = []
     self.input_packets = []
     self.publish_timer = None
     self.publish_time = 0
     self.publishPackets()
     self.lag = DEFAULT_LAGMAX
     self.lagmax_callbacks = []
     self.explain = PokerExplain()
示例#16
0
 def __init__(self):
     UGAMEClientProtocol.__init__(self)
     self.log = PokerClientProtocol.log.get_instance(self, refs=[
         ('User', self, lambda client: client.user.serial if client.user else None)
     ])
     self.callbacks = {
         'current': {},
         'not_current': {},
         'outbound': {}
         }
     self.setCurrentGameId(None)
     self.pending_auth_request = False
     self.publish_packets = []
     self.input_packets = []
     self.publish_timer = None
     self.publish_time = 0
     self.publishPackets()
     self.explain = PokerExplain()
     
     self._poll = False
示例#17
0
 def protocolInvalid(self, server, client):
     self.schedulePacket(PacketProtocolError(message = "Upgrade the client from\nhttp://mekensleep.org/\nServer version is %s\nClient version is %s" % ( server, client ) ))
     self.publishAllPackets()
     UGAMEClientProtocol.protocolInvalid(self, server, client)
示例#18
0
 def connectionMade(self):
     self.no_display_packets = self.factory.no_display_packets
     UGAMEClientProtocol.connectionMade(self)