You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/03/05 09:19:16 UTC

[tomcat] branch master updated: Sync for fillReadBuffer as javadoc says

This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new f148ae1  Sync for fillReadBuffer as javadoc says
f148ae1 is described below

commit f148ae1be37697c29d10779de89fe9f74b4867ba
Author: remm <re...@apache.org>
AuthorDate: Tue Mar 5 10:19:03 2019 +0100

    Sync for fillReadBuffer as javadoc says
---
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index de44f37..3b0e3d5 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1504,20 +1504,19 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
                 if (readNotify) {
                     return;
                 }
-                /*if (readPending.availablePermits() == 0) {
-                    readInterest = true;
-                } else {
-                    // If no read is pending, start waiting for data
-                    awaitBytes();
-                }*/
-                readInterest = true;
                 if (readPending.tryAcquire()) {
-                    try {
-                        fillReadBuffer(false);
-                    } catch (IOException e) {
-                        // Will never happen
-                        setError(e);
+                    // No read pending, so await bytes
+                    synchronized (readCompletionHandler) {
+                        readInterest = true;
+                        try {
+                            fillReadBuffer(false);
+                        } catch (IOException e) {
+                            // Will never happen
+                            setError(e);
+                        }
                     }
+                } else {
+                    readInterest = true;
                 }
             }
         }


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