Handle incoming UNSUBACK packet.
426030
def handle_unsuback(self):
        """"""
        self.logger.info("UNSUBACK received")

        ret, mid = self.in_packet.read_uint16()

        if ret != NC.ERR_SUCCESS:
            return ret

        evt = event.EventUnsuback(mid)
        self.push_event(evt)

        return NC.ERR_SUCCESS
988516
def handle(self):
        """"""
        data = self.request[0]
        sock = self.request[1]

        frame = KNXIPFrame.from_frame(data)

        if frame.service_type_id == KNXIPFrame.TUNNELING_REQUEST:
            req = KNXTunnelingRequest.from_body(frame.body)
            msg = CEMIMessage.from_body(req.cemi)
            send_ack = False

            tunnel = self.server.tunnel

            if msg.code == 0x29:
                # LData.req
                send_ack = True
            elif msg.code == 0x2e:
                # LData.con
                send_ack = True
            else:
                problem = "Unimplemented cEMI message code {}".format(msg.code)
                logging.error(problem)
                raise KNXException(problem)

            # Cache data
            if (msg.cmd == CEMIMessage.CMD_GROUP_WRITE) or (
                    msg.cmd == CEMIMessage.CMD_GROUP_RESPONSE):
                    # saw a value for a group address on the bus
                tunnel.received_message(msg.dst_addr, msg.data)

            # Put RESPONSES into the result queue
            if msg.cmd == CEMIMessage.CMD_GROUP_RESPONSE:
                tunnel.result_queue.put(msg.data)

            if send_ack:
                bodyack = [0x04, req.channel, req.seq, E_NO_ERROR]
                ack = KNXIPFrame(KNXIPFrame.TUNNELLING_ACK)
                ack.body = bodyack
                sock.sendto(ack.to_frame(), self.client_address)

        elif frame.service_type_id == KNXIPFrame.TUNNELLING_ACK:
            logging.debug("Received tunneling ACK")
            self.server.tunnel.ack_semaphore.release()
        elif frame.service_type_id == KNXIPFrame.DISCONNECT_RESPONSE:
            logging.debug("Disconnected")
            self.channel = None
            tunnel = self.server.tunnel
            tunnel.data_server.shutdown()
            tunnel.data_server = None
        elif frame.service_type_id == KNXIPFrame.CONNECTIONSTATE_RESPONSE:
            logging.debug("Connection state response")
            tunnel.connection_state = frame.body[2]
        else:
            logging.info(
                "Message type %s not yet implemented", frame.service_type_id)
30779
def handle(self, sock, read_data, path, headers):
        ""
        for i in range(self.attempts):
            try:
                server_sock = eventlet.connect(
                    tuple(random.choice(self.backends)),
                )
            except socket.error:
                eventlet.sleep(self.delay)
                continue
            # Function to help track data usage
            def send_onwards(data):
                server_sock.sendall(data)
                return len(data)
            try:
                size = send_onwards(read_data)
                size += SocketMelder(sock, server_sock).run()
            except socket.error, e:
                if e.errno != errno.EPIPE:
                    raise
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
1047900
async def umount(self):
        """"""
        self._data = await self._handler.unmount(
            system_id=self.block_device.node.system_id,
            device_id=self.block_device.id, id=self.id)
1368831
async def handler(event):
    """"""
    await asyncio.wait([
        event.delete(),
        event.respond(OFFTOPIC[event.chat_id], reply_to=event.reply_to_msg_id)
    ])
170348
@Override
	public boolean handleIncomingData()
	{
		lastRecvActivity = System.currentTimeMillis();
		
		while (inputBuffer.remaining() > 0)
		{		
			if (packetInputBuffer.size() == 0)
			{
				if (inputBuffer.remaining() >= 4) // packet_size = sizeof(int) = 4
				{
					int packetSize = inputBuffer.getInt();
					
					// Security check
					int actualMaxPacketSize = Integer.MAX_VALUE;
					if (maxPacketSize != -1)
						actualMaxPacketSize = trustedConnection ? maxPacketSize : 1024;
					
					if (packetSize > actualMaxPacketSize)
					{
						log.error("#"+id+" packet is too large : "+packetSize+" (maxPacketSize="+actualMaxPacketSize+"), dropping client.");
						return false;
					}
					
					packetInputBuffer.setSize(packetSize);
				}
				else
					return true; // Not enough data to proceed ...
			}
			else
			{
				// Append to current packet
				int readAmount = Math.min(inputBuffer.remaining(), packetInputBuffer.size() - currentInputOffset);
				packetInputBuffer.getFrom(inputBuffer, currentInputOffset, readAmount);
				currentInputOffset += readAmount;
				
				// Packet is complete ?
				if (currentInputOffset == packetInputBuffer.size())
				{
					AbstractPacket packet = unserializePacket(packetInputBuffer);
					if (packet == null)
						return false; // Invalid packet
					packetInputBuffer.clear();
					currentInputOffset = 0;
					
					if (traceEnabled)
	                    log.trace("#"+id+" Received "+packet);
					
					if (listener != null)
						trustedConnection = listener.packetReceived(packet);
				}
			}
		}
		
		return true;
	}
799923
def handle_call(self, body, message):
        """"""
        try:
            r = self._DISPATCH(body, ticket=message.properties['reply_to'])
        except self.Next:
            # don't reply, delegate to other agents.
            pass
        else:
            self.reply(message, r)
1135121
def abort():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x29)  # 00101001
    c = RejectCause()
    packet = a / b / c
    return packet
1129162
private void handlePacket(SelectableChannel channel, IncomingPacket incomingPacket) {
    String typeName = incomingPacket.unpackString();
    REQID rid = incomingPacket.unpackREQID();
    Message.Builder bldr = requestMap.get(typeName);
    boolean isRequest = false;
    if (bldr != null) {
      // This is a request
      isRequest = true;
    } else {
      bldr = messageMap.get(typeName);
    }
    if (bldr != null) {
      // Clear the earlier state of Message.Builder
      // Otherwise it would merge new Message with old state
      bldr.clear();

      incomingPacket.unpackMessage(bldr);
      if (bldr.isInitialized()) {
        Message msg = bldr.build();
        if (isRequest) {
          onRequest(rid, (SocketChannel) channel, msg);
        } else {
          onMessage((SocketChannel) channel, msg);
        }
      } else {
        // Message failed to be deser
        LOG.severe("Could not deserialize protobuf of type " + typeName);
        handleError(channel);
      }
      return;
    } else {
      LOG.severe("Unexpected protobuf type received " + typeName);
      handleError(channel);
    }
  }
670145
def _handle_sigint(self, signum: int, frame: Any) -> None:
        """"""
        logger.warning("Catched SIGINT")
        self.shutdown()
990068
def ungrab_server(self, onerror = None):
        """"""
        request.UngrabServer(display = self.display,
                             onerror = onerror)
1371190
def _tcpdump_callback(self, line, kill_switch):
    """"""

    line = line.lower()
    if ("listening" in line) or ("reading" in line):
        self.started = True
    if ("no suitable device" in line):
        self.error = True
        self.kill_switch()
    if "by kernel" in line:
        self.stopped = True
337975
def handle_stream(msg):
    """"""
    if not msg.gateway.is_sensor(msg.node_id):
        return None
    stream = msg.gateway.const.Stream(msg.sub_type)
    handler = stream.get_handler(msg.gateway.handlers)
    if handler is None:
        return None
    return handler(msg)
206037
public void handlePacket(final JsonNode packet) {
        if (async) {
            executorService.submit(() -> {
                try {
                    handle(packet);
                } catch (Throwable t) {
                    logger.warn("Couldn't handle packet of type {}. Please contact the developer! (packet: {})",
                            getType(), packet, t);
                }
            });
        } else {
            try {
                handle(packet);
            } catch (Throwable t) {
                logger.warn("Couldn't handle packet of type {}. Please contact the developer! (packet: {})",
                        getType(), packet, t);
            }
        }
    }
399649
def _receive_callback(self, raw_message):
        """"""
        message = self.backend.message_to_python(raw_message)

        if self.auto_ack and not message.acknowledged:
            message.ack()
        self.receive(message.payload, message)
1172728
def _handle_ping(self, packet, protocol):
        
        if 'payload' in packet:
            is_valid_node = True
            node_ids = list(packet['payload'].values())
            for node_id in node_ids:
                if self._repository.get_node(node_id) is None:
                    is_valid_node = False
                    break
            if is_valid_node:
                self._pong(packet, protocol)
        else:
            self._pong(packet, protocol)