private void handlePacket(final DatagramPacket datagram) {
    final int length = datagram.data().length();
    if (!validatePacketSize(length)) {
      LOG.debug("Discarding over-sized packet. Actual size (bytes): {}", length);
      return;
    }
    vertx.<Packet>executeBlocking(
        future -> {
          try {
            future.complete(packetDeserializer.decode(datagram.data()));
          } catch (final Throwable t) {
            future.fail(t);
          }
        },
        event -> {
          if (event.succeeded()) {
            // Acquire the senders coordinates to build a Peer representation from them.
            final String host = datagram.sender().host();
            final int port = datagram.sender().port();
            final Endpoint endpoint = new Endpoint(host, port, Optional.empty());
            handleIncomingPacket(endpoint, event.result());
          } else {
            if (event.cause() instanceof PeerDiscoveryPacketDecodingException
                || event.cause() instanceof DecodeException) {
              LOG.debug(
                  "Discarding invalid peer discovery packet: {}, {}",
                  event.cause().getMessage(),
                  event.cause());
            } else {
              LOG.error("Encountered error while handling packet", event.cause());
            }
          }
        });
  }
The UDP packet handler. This is the entrypoint for all received datagrams.

@param datagram the received datagram.
ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java