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/12/04 08:06:33 UTC

[tomcat] branch 8.5.x updated: NIO needs a write loop as demonstrated by BZ63949

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 bcee3c4  NIO needs a write loop as demonstrated by BZ63949
bcee3c4 is described below

commit bcee3c4d55802ba4572a8142152b512ab222edb2
Author: remm <re...@apache.org>
AuthorDate: Wed Dec 4 09:05:12 2019 +0100

    NIO needs a write loop as demonstrated by BZ63949
    
    Adapt commit f5f2b62670f972fc6a857788084e4352f2d4cd87
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index da1df9d..bfac6d7 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1520,7 +1520,15 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel> {
                                     }
                                 }
                                 if (doWrite) {
-                                    nBytes = getSocket().write(buffers, offset, length);
+                                    long n = 0;
+                                    do {
+                                        n = getSocket().write(buffers, offset, length);
+                                        if (n == -1) {
+                                            nBytes = n;
+                                        } else {
+                                            nBytes += n;
+                                        }
+                                    } while (n > 0);
                                     updateLastWrite();
                                 }
                             }


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