Check packet for ack.
558460
def _packet_ack(self, packet, sequence):
        
        if packet["sequence"] == sequence:
            if packet["payloadtype"] == PayloadType.SETCOLOR:
                # notify about colour change
                self._color_callback(packet["target"],
                                     packet["hue"],
                                     packet["sat"],
                                     packet["bri"],
                                     packet["kel"])

            elif packet["payloadtype"] == PayloadType.SETPOWER2:
                # notify about power change
                self._power_callback(packet["target"],
                                     packet["power"])

            return False

        return True
382112
def check(self, order, sids):
        '''  '''
        payload = "{}"
        #TODO store hashes {'intuition': {'id1': value, 'id2': value}}
        # Block self.timeout seconds on self.channel for a message
        raw_msg = self.client.blpop(self.channel, timeout=self.timeout)
        if raw_msg:
            _, payload = raw_msg

            msg = json.loads(payload.replace("'", '"'), encoding='utf-8')
            for sid in msg.keys():
                #TODO Harmonize lower() and upper() symbols
                if sid.lower() in map(str.lower, sids):
                    print('ordering {} of {}'.format(msg[sid], sid))
                    #order(sid.upper(), msg[sid])
                    order(sid, msg[sid])
                else:
                    print('skipping unknown symbol {}'.format(sid))
925417
def packet_handle(self):
        """"""
        cmd = self.in_packet.command & 0xF0
        
        if cmd == NC.CMD_CONNACK:
            return self.handle_connack()
        elif cmd == NC.CMD_PINGRESP:
            return self.handle_pingresp()
        elif cmd == NC.CMD_PUBLISH:
            return self.handle_publish()
        elif cmd == NC.CMD_PUBACK:
            return self.handle_puback()
        elif cmd == NC.CMD_PUBREC:
            return self.handle_pubrec()
        elif cmd == NC.CMD_PUBREL:
            return self.handle_pubrel()
        elif cmd == NC.CMD_PUBCOMP:
            return self.handle_pubcomp()
        elif cmd == NC.CMD_SUBSCRIBE:
            sys.exit(-1)
        elif cmd == NC.CMD_SUBACK:
            return self.handle_suback()
        elif cmd == NC.CMD_UNSUBSCRIBE:
            print "Received UNSUBSCRIBE"
            sys.exit(-1)
        elif cmd == NC.CMD_UNSUBACK:
            return self.handle_unsuback()
        else:
            self.logger.warning("Unknown protocol. Cmd = %d", cmd)
            return NC.ERR_PROTOCOL
233658
def loop_misc(self):
        """"""
        if self._sock is None and self._ssl is None:
            return MQTT_ERR_NO_CONN

        now = time.time()
        self._check_keepalive()
        if self._last_retry_check+1 < now:
            # Only check once a second at most
            self._message_retry_check()
            self._last_retry_check = now

        if self._ping_t > 0 and now - self._ping_t >= self._keepalive:
            # client->ping_t != 0 means we are waiting for a pingresp.
            # This hasn't happened in the keepalive time so we should disconnect.
            if self._ssl:
                self._ssl.close()
                self._ssl = None
            elif self._sock:
                self._sock.close()
                self._sock = None

            self._callback_mutex.acquire()
            if self._state == mqtt_cs_disconnecting:
                rc = MQTT_ERR_SUCCESS
            else:
                rc = 1
            if self.on_disconnect:
                self._in_callback = True
                self.on_disconnect(self, self._userdata, rc)
                self._in_callback = False
            self._callback_mutex.release()
            return MQTT_ERR_CONN_LOST

        return MQTT_ERR_SUCCESS
382457
public boolean isAck() {
    if (message == null) {
      return false;
    }

    return (((Request) message).getMethod().equals(Request.ACK));
  }
1018886
def _check_connection(self):
        """"""
        try:
            super()._check_connection()
        except OSError as exc:
            _LOGGER.error(exc)
            self.protocol.transport.close()
            self.protocol.conn_lost_callback()
            return
        task = self.loop.call_later(
            self.reconnect_timeout + 0.1, self._check_connection)
        self.cancel_check_conn = task.cancel
1189992
def expectAck(self):
        
        last = self.lastTransmitted
        self.ackPredicate = lambda ackPacket: (
            ackPacket.relativeAck() >= last.relativeSeq()
        )
163589
def determine_packet_positions(self):
        """"""
        print("Analysing file...")
        self.rewind_file()
        with ignored(struct.error):
            while True:
                pointer_position = self.blob_file.tell()
                length = struct.unpack('<i', self.blob_file.read(4))[0]
                self.packet_positions.append(pointer_position)
                self.blob_file.seek(length, 1)
        self.rewind_file()
        print("Found {0} CLB UDP packets.".format(len(self.packet_positions)))
545491
def _check_connection(self):
        """"""
        if ((self.tcp_disconnect_timer + 2 * self.reconnect_timeout) <
                time.time()):
            self.tcp_disconnect_timer = time.time()
            raise OSError('No response from {}. Disconnecting'.format(
                self.server_address))
        if (self.tcp_check_timer + self.reconnect_timeout) >= time.time():
            return
        msg = Message().modify(
            child_id=255, type=self.const.MessageType.internal,
            sub_type=self.const.Internal.I_VERSION)
        self.add_job(msg.encode)
        self.tcp_check_timer = time.time()
239713
async def _process_ack(self, msg):
        
        pub_ack = protocol.PubAck()
        pub_ack.ParseFromString(msg.data)

        # Unblock pending acks queue if required.
        if not self._pending_pub_acks_queue.empty():
            await self._pending_pub_acks_queue.get()

        try:
            cb = self._pub_ack_map[pub_ack.guid]
            await cb(pub_ack)
            del self._pub_ack_map[pub_ack.guid]
        except KeyError:
            # Just skip the pub ack
            return
        except:
            # TODO: Check for protocol error
            return
67595
def read_packet

      pkts = []
      if wait_for_byte(BT_SYNC) and wait_for_byte(BT_SYNC)
        plen = getbyte
        if plen and plen < BT_SYNC
          pkts = read_payload(plen)
        else
          $stderr.puts "Invalid packet size: #{plen} bytes" if @verbose
        end
      end
      pkts
    end
1260820
def recv_raw(self, x=MTU):
        """"""  # noqa: E501
        pkt, sa_ll = self.ins.recvfrom(x)
        if self.outs and sa_ll[2] == socket.PACKET_OUTGOING:
            return None, None, None
        ts = get_last_packet_timestamp(self.ins)
        return self.LL, pkt, ts
1053376
def _check(self):
        """"""
        final = self._md_context.digest()
        exp = self._inf._md_expect
        if exp is None:
            return
        if final is None:
            return
        if self._returncode:
            check_returncode(self, '')
        if self._remain != 0:
            raise BadRarFile("Failed the read enough data")
        if final != exp:
            raise BadRarFile("Corrupt file - CRC check failed: %s - exp=%r got=%r" % (
                self._inf.filename, exp, final))
1076672
function CheckPacket(tx, view, flags) {
  Packet.call(this);
  this.tx = tx || null;
  this.view = view || null;
  this.flags = flags != null ? flags : null;
}
415017
function ECVerifyPacket(msg, sig, key) {
  Packet.call(this);
  this.msg = msg || null;
  this.sig = sig || null;
  this.key = key || null;
}
951166
def parse_packet(packet):
    """"""
    frame = parse_ltv_packet(packet)
    if frame is None:
        frame = parse_ibeacon_packet(packet)
    return frame
1332029
def pkt2uptime(pkt, HZ=100):
    """"""
    if not isinstance(pkt, Packet):
        raise TypeError("Not a TCP packet")
    if isinstance(pkt, NoPayload):
        raise TypeError("Not a TCP packet")
    if not isinstance(pkt, TCP):
        return pkt2uptime(pkt.payload)
    for opt in pkt.options:
        if opt[0] == "Timestamp":
            # t = pkt.time - opt[1][0] * 1.0/HZ
            # return time.ctime(t)
            t = opt[1][0] / HZ
            return t
    raise TypeError("No timestamp option")