def connect_game(self, GID):
     game = self.games[GID]
     msg = mpwp_protocol.get_mpwp_status_packet(
         mpwp_protocol.STATUS_CONNECT_OK, GID,
         mpwp_protocol.GAME_MANAGER_ID)
     self.send_to_game_cb(msg)
     self.alert_game_created(game)
 def send_connect_ok(self, FROM):
     msg = mpwp_protocol.get_mpwp_status_packet(mpwp_protocol.STATUS_CONNECT_OK,
                                                self.ID,
                                                FROM)
     msg = self.pack(msg)
     self.log(1, msg)
     self.send_ws(msg)
 def connect_game(self, GID):
     game = self.games[GID]
     msg = mpwp_protocol.get_mpwp_status_packet(mpwp_protocol.STATUS_CONNECT_OK,
                                                GID,
                                                mpwp_protocol.GAME_MANAGER_ID)
     self.send_to_game_cb(msg)
     self.alert_game_created(game)
Ejemplo n.º 4
0
    def connect_to_manager(self):
        self.dealer_sock.connect("tcp://localhost:6000")

        msg = mpwp_protocol.get_mpwp_status_packet(mpwp_protocol.STATUS_CONNECT,
                                                   mpwp_protocol.GAME_MANAGER_ID,
                                                   self.GID)
        self.dealer_sock.send_multipart(msg)

        # could get stuck forever here if msg fails

        rep = self.dealer_sock.recv_multipart()

        return rep[mpwp_protocol.MSG_STATUS] == mpwp_protocol.STATUS_CONNECT_OK
 def send_connect_ok(self, FROM):
     msg = mpwp_protocol.get_mpwp_status_packet(
         mpwp_protocol.STATUS_CONNECT_OK, self.ID, FROM)
     msg = self.pack(msg)
     self.log(1, msg)
     self.send_ws(msg)
Ejemplo n.º 6
0
    def send_register_ok(self, cid):
        packet = mpwp_protocol.get_mpwp_status_packet(mpwp_protocol.STATUS_REGISTER_OK,
                                                      cid,
                                                      self.GID)

        self.dealer_sock.send_multipart(packet)
 def test_get_mpwp_status_packet(self):
     packet = mpwp_protocol.get_mpwp_status_packet(b'100', b'0', b'1')
     self.assertEqual([b'mpwp_v1.0', b'100', b'0', b'1'], packet)
 def test_get_mpwp_status_packet(self):
     packet = mpwp_protocol.get_mpwp_status_packet(b'100', b'0', b'1')
     self.assertEqual([b'mpwp_v1.0', b'100', b'0', b'1'], packet)