This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 5a55179 Avoid duplicate read registrations for blocking I/O with NIO 5a55179 is described below commit 5a55179a049ec39246c8ba76073ab4485542b98c Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Nov 22 10:15:14 2021 +0000 Avoid duplicate read registrations for blocking I/O with NIO --- java/org/apache/tomcat/util/net/NioEndpoint.java | 7 ++++--- webapps/docs/changelog.xml | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 34acce6..de72805 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1252,8 +1252,10 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> if (n == -1) { throw new EOFException(); } else if (n == 0) { - readBlocking = true; - registerReadInterest(); + if (!readBlocking) { + readBlocking = true; + registerReadInterest(); + } synchronized (readLock) { if (readBlocking) { try { @@ -1266,7 +1268,6 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> } catch (InterruptedException e) { // Continue } - readBlocking = false; } } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 2eb6c43..861409b 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -133,6 +133,10 @@ bug</a> that causes the acceptor to report an incoming connection more than once. (markt) </add> + <fix> + Avoid unnecessary duplicate read registrations for blocking I/O with the + NIO connector. (markt) + </fix> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org