Check if the last outstanding packet has not received an ack before
it is timed out.
If true, for now just log it.
We will provide a decent solution to this later on.
422470
private void checkIfLastPacketTimeout() {
     synchronized (ackQueue) {
             if( !ackQueue.isEmpty()  && (
                             System.currentTimeMillis() - lastPacketSentTime > packetTimeout) ) {
               DFSClient.LOG.warn("Packet " + ackQueue.getLast().seqno +
                             " of " + block + " is timed out");
             }
     }
  }
100306
def valid_body_waiting(self):
        
        # 0f f8 be 04 00 08 00 00 2f 04
        packet_size = velbus.MINIMUM_MESSAGE_SIZE + \
            (self.buffer[3] & 0x0F)
        if len(self.buffer) < packet_size:
            self.logger.debug("Buffer does not yet contain full message")
            result = False
        else:
            result = True
            result = result and self.buffer[packet_size - 1] == velbus.END_BYTE
            if not result:
                self.logger.warning("End byte not recognized")
            result = result and velbus.checksum(
                self.buffer[0:packet_size - 2])[0] == self.buffer[packet_size - 2]
            if not result:
                self.logger.warning("Checksum not recognized")
        self.logger.debug("Valid Body Waiting: %s (%s)", result, str(self.buffer))
        return result
141759
async def check_ping_timeout(self):
        
        if self.closed:
            raise exceptions.SocketIsClosedError()
        if time.time() - self.last_ping > self.server.ping_interval + 5:
            self.server.logger.info('%s: Client is gone, closing socket',
                                    self.sid)
            # Passing abort=False here will cause close() to write a
            # CLOSE packet. This has the effect of updating half-open sockets
            # to their correct state of disconnected
            await self.close(wait=False, abort=False)
            return False
        return True
1092748
private void timeoutHasExpired(final Timeout timeout, final TimeoutExpirationContext context) {
        try {
            addMessage(timeout, context.getOriginalHeaders());
        } catch (Exception ex) {
            LOG.error("Error handling timeout {}", timeout, ex);
        }
    }
1235365
public void completeTxTimeout() throws TransactionRolledbackException
    {
        final boolean traceOn = TraceComponent.isAnyTracingEnabled();

        if (traceOn && tc.isEntryEnabled())
            Tr.entry(tc, "completeTxTimeout");

        if (tx != null && tx.isTimedOut())
        {
            if (traceOn && tc.isEventEnabled())
                Tr.event(tc, "Transaction has timed out. The transaction will be rolled back now");
            Tr.info(tc, "WTRN0041_TXN_ROLLED_BACK", tx.getTranName());
            ((EmbeddableTransactionImpl) tx).rollbackResources();

            final TransactionRolledbackException rbe = new TransactionRolledbackException("Transaction is ended due to timeout");

            FFDCFilter.processException(rbe, "com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerImpl.completeTxTimeout", "100", this);
            if (traceOn && tc.isEntryEnabled())
                Tr.exit(tc, "completeTxTimeout", rbe);
            throw rbe;
        }

        if (traceOn && tc.isEntryEnabled())
            Tr.exit(tc, "completeTxTimeout");
    }
869029
def check(timeout = nil, &block)
      message = nil

      @mutex.lock
      begin
        raise MailboxDead, "attempted to receive from a dead mailbox" if @dead

        message = nil
        Timers::Wait.for(timeout) do |remaining|
          message = next_message(&block)

          break if message

          @condition.wait(@mutex, remaining)
        end
      ensure
        begin
          @mutex.unlock
        rescue
          nil
        end
      end

      message
    end
467035
function CheckDevAck() {
        self.Debug (3,"Waiting Acknowledgment Response %d/%d", self.retry, smsc.opts.retry);
        smsc.GetFrom (CheckDevAckCB, smscmd.phone)
    }
1166429
def _recv_nack(self, method_frame):
        ''''''
        if self._nack_listener:
            delivery_tag = method_frame.args.read_longlong()
            multiple, requeue = method_frame.args.read_bits(2)
            if multiple:
                while self._last_ack_id < delivery_tag:
                    self._last_ack_id += 1
                    self._nack_listener(self._last_ack_id, requeue)
            else:
                self._last_ack_id = delivery_tag
                self._nack_listener(self._last_ack_id, requeue)
750268
def _recv_ack(self, method_frame):
        ''''''
        if self._ack_listener:
            delivery_tag = method_frame.args.read_longlong()
            multiple = method_frame.args.read_bit()
            if multiple:
                while self._last_ack_id < delivery_tag:
                    self._last_ack_id += 1
                    self._ack_listener(self._last_ack_id)
            else:
                self._last_ack_id = delivery_tag
                self._ack_listener(self._last_ack_id)
58709
def _check_timeout(start_time, timeout):
    '''
    
    '''
    timeout_milisec = timeout * 60000
    if timeout_milisec < (int(round(time.time() * 1000)) - start_time):
        raise salt.exceptions.TimeoutError('Timeout expired.')
134048
def handle(self, pkt, raddress, rport):
        ""
        if isinstance(pkt, TftpPacketACK):
            log.debug("Received ACK for packet %d" % pkt.blocknumber)
            # Is this an ack to the one we just sent?
            if self.context.next_block == pkt.blocknumber:
                if self.context.pending_complete:
                    log.info("Received ACK to final DAT, we're done.")
                    return None
                else:
                    log.debug("Good ACK, sending next DAT")
                    self.context.next_block += 1
                    log.debug("Incremented next_block to %d",
                        self.context.next_block)
                    self.context.pending_complete = self.sendDAT()

            elif pkt.blocknumber < self.context.next_block:
                log.warning("Received duplicate ACK for block %d"
                    % pkt.blocknumber)
                self.context.metrics.add_dup(pkt)

            else:
                log.warning("Oooh, time warp. Received ACK to packet we "
                         "didn't send yet. Discarding.")
                self.context.metrics.errors += 1
            return self
        elif isinstance(pkt, TftpPacketERR):
            log.error("Received ERR packet from peer: %s" % str(pkt))
            raise TftpException("Received ERR packet from peer: %s" % str(pkt))
        else:
            log.warning("Discarding unsupported packet: %s" % str(pkt))
            return self
780945
synchronized public void check() {
		if(lastCheckpoint < 0) {
			lastCheckpoint = System.currentTimeMillis();
		}
		
		requests++;
		long interval = System.currentTimeMillis() - lastCheckpoint;
		if(requests >= maxRequests) {
			try {
				long sleepTime = minInterval - interval;
				if(sleepTime > 0) {
					logger.info("Request limit reached. Wait for " + sleepTime/1000 + " seconds");
					Thread.sleep(sleepTime);
				}
			} catch (InterruptedException e) {
				logger.error(e.getMessage());
				return;
			}
			finally {
				requests = 0;
				lastCheckpoint = System.currentTimeMillis();
			}
		}
		else if(interval > minInterval) {
			requests = 0;
			lastCheckpoint = System.currentTimeMillis();
		}
	}
480160
def _check_timeouts(self):
        

        for conn_id, data in self._connections.items():
            if 'timeout' in data and data['timeout'].expired:
                if data['state'] == self.Connecting:
                    self.finish_connection(conn_id, False, 'Connection attempt timed out')
                elif data['state'] == self.Disconnecting:
                    self.finish_disconnection(conn_id, False, 'Disconnection attempt timed out')
                elif data['state'] == self.InProgress:
                    if data['microstate'] == 'rpc':
                        self.finish_operation(conn_id, False, 'RPC timed out without response', None, None)
                    elif data['microstate'] == 'open_interface':
                        self.finish_operation(conn_id, False, 'Open interface request timed out')
1231978
private void sendAck()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "sendAck");

        long completedPrefix = oststream.getCompletedPrefix();

        // Now that all messages are delivered we need to send Acks
        // sendAck back to sending ME (RemoteMessageTransmitter)
        try
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "sendAck up to: " + completedPrefix);

            upControl.sendAckMessage(
                                     streamSet.getRemoteMEUuid(),
                                     streamSet.getDestUuid(),
                                     streamSet.getBusUuid(),
                                     completedPrefix,
                                     priority,
                                     reliability,
                                     streamSet.getStreamID(),
                                     true);
            this._lastAckedTick = completedPrefix;
        } catch (SIResourceException e)
        {
            //FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.gd.GuaranteedTargetStream.sendAck",
                                        "1:2019:1.110",
                                        this);

            SibTr.exception(tc, e);

            //TODO don't know what to do here - rethrow?!
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "sendAck");
    }
727535
def last_downtime
      send_message!(Protocol::Device::GetInfo.new,
         wait_for: Protocol::Device::StateInfo) do |payload|
        payload.downtime.to_f / NSEC_IN_SEC
      end
    end
891588
def _did_timeout(self):
        

        bambou_logger.debug('Bambou %s on %s has timeout (timeout=%ss)..' % (self._request.method, self._request.url, self.timeout))
        self._has_timeouted = True

        if self.async:
            self._callback(self)
        else:
            return self
1047439
def should_send_ping?(now, keep_alive, last_packet_received_at)
      last_pingreq_sent_at = @sender.last_pingreq_sent_at
      last_pingresp_received_at = @handler.last_pingresp_received_at
      if !last_pingreq_sent_at || (last_pingresp_received_at && (last_pingreq_sent_at <= last_pingresp_received_at))
        next_pingreq_at = [@sender.last_packet_sent_at, last_packet_received_at].min + (keep_alive * 0.7).ceil
        return next_pingreq_at <= now
      end
    end