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 c946142  Add sync back after #4366
c946142 is described below

commit c946142b886e1c103fd1ad992f5cb9c6604b99f1
Author: remm <r...@apache.org>
AuthorDate: Fri May 17 13:07:59 2019 +0200

    Add sync back after #4366
---
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java 
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index b1a038d..e1ab5d0 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1016,9 +1016,11 @@ public class Nio2Endpoint extends 
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
                     long nBytes = 0;
                     // If there is still data inside the main read buffer, it 
needs to be read first
                     if (!socketBufferHandler.isReadBufferEmpty()) {
-                        socketBufferHandler.configureReadBufferForRead();
-                        for (int i = 0; i < length && 
!socketBufferHandler.isReadBufferEmpty(); i++) {
-                            nBytes += 
transfer(socketBufferHandler.getReadBuffer(), buffers[offset + i]);
+                        synchronized (readCompletionHandler) {
+                            socketBufferHandler.configureReadBufferForRead();
+                            for (int i = 0; i < length && 
!socketBufferHandler.isReadBufferEmpty(); i++) {
+                                nBytes += 
transfer(socketBufferHandler.getReadBuffer(), buffers[offset + i]);
+                            }
                         }
                         if (nBytes > 0) {
                             completion.completed(Long.valueOf(nBytes), this);


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

Reply via email to