Ejemplo n.º 1
0
 def pubrel(self, sock, packet):
     myclient = self.clients[sock]
     pub = myclient.pubrel(packet.packetIdentifier)
     if pub:
         if self.options["publish_on_pubrel"]:
             self.broker.publish(myclient.id, pub.topicName, pub.data,
                                 pub.fh.QoS, pub.fh.RETAIN, pub.properties,
                                 pub.receivedTime)
             del myclient.inbound[packet.packetIdentifier]
         else:
             myclient.inbound.remove(packet.packetIdentifier)
     resp = MQTTV5.Pubcomps()
     logger.info(
         "[MQTT5-2.2.1-5-pubcomp] pubcomp message id same as publish")
     resp.packetIdentifier = packet.packetIdentifier
     if not pub:
         resp.reasonCode.set("Packet identifier not found")
         resp.properties.ReasonString = "Looking for packet id " + str(
             packet.packetIdentifier)
     elif (hasattr(pub, "topicName") and pub.topicName == "test_qos_1_2_errors_pubcomp") or \
          (hasattr(myclient, "pubcomp_error") and myclient.pubcomp_error == packet.packetIdentifier):
         resp.reasonCode.set("Packet identifier not found")
         if hasattr(packet.properties, "UserProperty"):
             resp.properties.UserProperty = packet.properties.UserProperty
         if hasattr(myclient, "pubcomp_error"):
             del myclient.pubcomp_error
     respond(sock, resp)
Ejemplo n.º 2
0
 def pubrel(self, sock, packet):
   myclient = self.clients[sock]
   pub = myclient.pubrel(packet.packetIdentifier)
   if pub:
     if self.publish_on_pubrel:
       self.broker.publish(myclient.id, pub.topicName, pub.data, pub.fh.QoS, pub.properties,
             pub.receivedTime, pub.fh.RETAIN)
       del myclient.inbound[packet.packetIdentifier]
     else:
       myclient.inbound.remove(packet.packetIdentifier)
   resp = MQTTV5.Pubcomps()
   logger.info("[MQTT-2.3.1-6] pubcomp messge id same as publish")
   resp.packetIdentifier = packet.packetIdentifier
   respond(sock, resp)
Ejemplo n.º 3
0
    def __init__(self, socket):
        logger.debug("initializing receiver")
        self.socket = socket
        self.stopping = False
        self.paused = False

        self.inMsgs = {}
        self.outMsgs = {}

        self.puback = MQTTV5.Pubacks()
        self.pubrec = MQTTV5.Pubrecs()
        self.pubrel = MQTTV5.Pubrels()
        self.pubcomp = MQTTV5.Pubcomps()
        self.running = False