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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 5bbccbc  Sync for fillReadBuffer as javadoc says
5bbccbc is described below

commit 5bbccbc2f3cd57cd12273d9ad02e0d727b2e128b
Author: remm <r...@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 547ed23..226e421 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1472,20 +1472,19 @@ public class Nio2Endpoint extends 
AbstractJsseEndpoint<Nio2Channel> {
                 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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to