From 1c3b576bba58ecf2fc358d057ec312ebd10e1248 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Tue, 16 Feb 2010 06:20:40 +0000 Subject: [PATCH] Various broker fixes --- network-broker/network-broker | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/network-broker/network-broker b/network-broker/network-broker index a895cb7..97f5805 100755 --- a/network-broker/network-broker +++ b/network-broker/network-broker @@ -123,13 +123,14 @@ class StopPacket(Packet): return struct.pack(">HHL", self.magic, self.type, self.size) -class RegisterData(Packet): +class RegisterDataPacket(Packet): def __init__(self, key = -1, metadata = 0, data = ""): Packet.__init__(self) self.type = REGISTER_DATA self.key = key self.metadata = metadata self.data = data + self.size = self.size + 8 def get_key(self): return self.key @@ -417,6 +418,7 @@ class BrokerPacketHandler(SocketServer.DatagramRequestHandler): type = struct.unpack(">H", data[off + 2:off + 4])[0] size = struct.unpack(">L", data[off + 4:off + 8])[0] + print " Pkt", type if type == STOP: break @@ -582,7 +584,7 @@ def ping_thread_fn(broker, time_to_sleep): packet_class_by_type = { CONNECT_TO_BROKER : ConnectToBrokerPacket, SELECT_PEER : SelectPeerPacket, - REGISTER_DATA : RegisterData, + REGISTER_DATA : RegisterDataPacket, ACK : PingAckPacket, }