mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-22 19:39:24 +01:00
Various broker fixes
This commit is contained in:
parent
5895e06a29
commit
1c3b576bba
@ -123,13 +123,14 @@ class StopPacket(Packet):
|
|||||||
return struct.pack(">HHL", self.magic, self.type, self.size)
|
return struct.pack(">HHL", self.magic, self.type, self.size)
|
||||||
|
|
||||||
|
|
||||||
class RegisterData(Packet):
|
class RegisterDataPacket(Packet):
|
||||||
def __init__(self, key = -1, metadata = 0, data = ""):
|
def __init__(self, key = -1, metadata = 0, data = ""):
|
||||||
Packet.__init__(self)
|
Packet.__init__(self)
|
||||||
self.type = REGISTER_DATA
|
self.type = REGISTER_DATA
|
||||||
self.key = key
|
self.key = key
|
||||||
self.metadata = metadata
|
self.metadata = metadata
|
||||||
self.data = data
|
self.data = data
|
||||||
|
self.size = self.size + 8
|
||||||
|
|
||||||
def get_key(self):
|
def get_key(self):
|
||||||
return self.key
|
return self.key
|
||||||
@ -417,6 +418,7 @@ class BrokerPacketHandler(SocketServer.DatagramRequestHandler):
|
|||||||
type = struct.unpack(">H", data[off + 2:off + 4])[0]
|
type = struct.unpack(">H", data[off + 2:off + 4])[0]
|
||||||
size = struct.unpack(">L", data[off + 4:off + 8])[0]
|
size = struct.unpack(">L", data[off + 4:off + 8])[0]
|
||||||
|
|
||||||
|
print " Pkt", type
|
||||||
if type == STOP:
|
if type == STOP:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -582,7 +584,7 @@ def ping_thread_fn(broker, time_to_sleep):
|
|||||||
packet_class_by_type = {
|
packet_class_by_type = {
|
||||||
CONNECT_TO_BROKER : ConnectToBrokerPacket,
|
CONNECT_TO_BROKER : ConnectToBrokerPacket,
|
||||||
SELECT_PEER : SelectPeerPacket,
|
SELECT_PEER : SelectPeerPacket,
|
||||||
REGISTER_DATA : RegisterData,
|
REGISTER_DATA : RegisterDataPacket,
|
||||||
ACK : PingAckPacket,
|
ACK : PingAckPacket,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user