mqtt/pdu.py
def decode(self, packet):
        '''
        Decode a CONNACK control packet. 
        '''
        self.encoded = packet
        # Strip the fixed header plus variable length field
        lenLen = 1
        while packet[lenLen] & 0x80:
            lenLen += 1
        packet_remaining = packet[lenLen+1:]
        self.session = (packet_remaining[0] & 0x01) == 0x01 
        self.resultCode  = int(packet_remaining[1])
def decode(self, packet):
        '''
        Decode a CONNACK control packet. 
        '''
        self.encoded = packet
        # Strip the fixed header plus variable length field
        lenLen = 1
        while packet[lenLen] & 0x80:
            lenLen += 1
        packet_remaining = packet[lenLen+1:]
        self.session = (packet_remaining[0] & 0x01) == 0x01 
        self.resultCode  = int(packet_remaining[1])
Decode a CONNACK control packet.