eubnara commented on code in PR #8106:
URL: https://github.com/apache/hadoop/pull/8106#discussion_r2567612919
##########
hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/server/dns/RegistryDNS.java:
##########
@@ -805,6 +832,65 @@ public void nioTCPClient(SocketChannel ch) throws
IOException {
}
+ /**
+ * Process a UDP request.
+ *
+ * @param channel the datagram channel for the request.
+ * @param remoteAddress the socket address of client.
+ * @param input the input ByteBuffer.
+ * @throws IOException if the udp processing generates an issue.
+ */
+ public void nioUDPClient(DatagramChannel channel, SocketAddress
remoteAddress, ByteBuffer input) throws IOException {
+ ByteBuffer output = ByteBuffer.allocate(4096);
+ byte[] in = null;
+ byte[] response = null;
+ Message query = null;
+ try {
+ try {
+ int position = input.position();
+ in = new byte[position];
+ input.flip();
+ input.get(in);
+ query = new Message(in);
+ LOG.info("{}: received UDP query {}", remoteAddress,
+ query.getQuestion());
+ response = generateReply(query, null);
+ if (response.length > output.capacity()) {
+ LOG.warn("{}: Response of UDP query {} exceeds limit {}",
+ remoteAddress, query.getQuestion(), output.limit());
+ query.getHeader().setFlag(Flags.TC);
Review Comment:
If the response of UDP query exceeds limit, TC(truncated) flag should be set
in order for the client to request again with TCP query.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]