You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/07/15 16:04:00 UTC

[tomcat] branch main updated: Improve comments

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 ef6f15d  Improve comments
ef6f15d is described below

commit ef6f15d82443568d8a92838eff47850d0378c349
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jul 15 16:59:51 2021 +0100

    Improve comments
---
 java/org/apache/tomcat/util/net/NioEndpoint.java      | 10 +++++-----
 java/org/apache/tomcat/util/net/SecureNioChannel.java |  2 --
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index c50c720..ffdecc2 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1315,7 +1315,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                      * write it as part of a subsequent write call.
                      *
                      * Because of the above, when a timeout is triggered we need
-                     * so skip subsequent attempts to write as otherwise it will
+                     * to skip subsequent attempts to write as otherwise it will
                      * appear to the client as if some data was dropped just
                      * before the connection is lost. It is better if the client
                      * just sees the dropped connection.
@@ -1363,10 +1363,6 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                         startNanos = 0;
                     }
                 } while (buffer.hasRemaining());
-                // If there is data left in the buffer the socket will be registered for
-                // write further up the stack. This is to ensure the socket is only
-                // registered for write once as both container and user code can trigger
-                // write registration.
             } else {
                 do {
                     n = getSocket().write(buffer);
@@ -1374,6 +1370,10 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
                         throw new EOFException();
                     }
                 } while (n > 0 && buffer.hasRemaining());
+                // If there is data left in the buffer the socket will be registered for
+                // write further up the stack. This is to ensure the socket is only
+                // registered for write once as both container and user code can trigger
+                // write registration.
             }
             updateLastWrite();
         }
diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index de47904..63af010 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -788,8 +788,6 @@ public class SecureNioChannel extends NioChannel {
     public int write(ByteBuffer src) throws IOException {
         checkInterruptStatus();
         if (src == this.netOutBuffer) {
-            //we can get here through a recursive call
-            //by using the NioBlockingSelector
             int written = sc.write(src);
             return written;
         } else {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org