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 e4f2ee2  Fix edge case causing a missing initial notification
e4f2ee2 is described below

commit e4f2ee28babfd53b4d0141e78ecd0eb3836a4296
Author: remm <r...@apache.org>
AuthorDate: Tue Mar 5 16:28:55 2019 +0100

    Fix edge case causing a missing initial notification
    
    This could be seen on CI #4110, which I managed to reproduce. Hopefully
    will not cause regressions.
---
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java 
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index 3b0e3d5..bba8d97 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1504,19 +1504,19 @@ public class Nio2Endpoint extends 
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
                 if (readNotify) {
                     return;
                 }
+                readInterest = true;
                 if (readPending.tryAcquire()) {
                     // No read pending, so await bytes
-                    synchronized (readCompletionHandler) {
-                        readInterest = true;
-                        try {
-                            fillReadBuffer(false);
-                        } catch (IOException e) {
-                            // Will never happen
-                            setError(e);
+                    try {
+                        if (fillReadBuffer(false) > 0) {
+                            // Special case where the read completes inline, 
there is no notification
+                            // in that case and it cannot happen elsewhere
+                            
getEndpoint().processSocket(Nio2SocketWrapper.this, SocketEvent.OPEN_READ, 
true);
                         }
+                    } 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