This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 72823b4ea0 Align NioChannel and SecureNioChannel
72823b4ea0 is described below
commit 72823b4ea06b68ece3663d8d8d998359967673b0
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Apr 17 10:42:29 2024 +0100
Align NioChannel and SecureNioChannel
Skipping empty writes can provide a performance improvement for some
frameworks - typically those that call flush() more than they need to
---
java/org/apache/tomcat/util/net/NioChannel.java | 4 ++++
webapps/docs/changelog.xml | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/java/org/apache/tomcat/util/net/NioChannel.java
b/java/org/apache/tomcat/util/net/NioChannel.java
index 96493ed75a..da0d165d1b 100644
--- a/java/org/apache/tomcat/util/net/NioChannel.java
+++ b/java/org/apache/tomcat/util/net/NioChannel.java
@@ -133,6 +133,10 @@ public class NioChannel implements ByteChannel,
ScatteringByteChannel, Gathering
@Override
public int write(ByteBuffer src) throws IOException {
checkInterruptStatus();
+ if (!src.hasRemaining()) {
+ // Nothing left to write
+ return 0;
+ }
return sc.write(src);
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d24e2b190a..de4e1b77a2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -127,6 +127,14 @@
</fix>
</changelog>
</subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ Align non-secure and secure writes with NIO and skip the write attempt
+ when there are no bytes to be written. (markt)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Other">
<changelog>
<update>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]