You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/03/22 21:44:50 UTC
[tomcat] branch master updated (174fa56 -> c34b60e)
This is an automated email from the ASF dual-hosted git repository.
markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.
from 174fa56 Better variable name. These are request headers, not response headers.
new b66b1f2 Refactor isReady() in preparation for fix of BZ 64771
new c34b60e Refactor setReadListener() in preparation for fix for BZ 64771
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/catalina/connector/InputBuffer.java | 22 +--------------------
java/org/apache/coyote/Request.java | 23 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 21 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 02/02: Refactor setReadListener() in preparation for fix
for BZ 64771
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit c34b60e9432a34242c0ba8c1498efa0a171fba62
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Mar 22 21:45:21 2021 +0000
Refactor setReadListener() in preparation for fix for BZ 64771
https://bz.apache.org/bugzilla/show_bug.cgi?id=64771
---
java/org/apache/catalina/connector/InputBuffer.java | 16 ----------------
java/org/apache/coyote/Request.java | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/java/org/apache/catalina/connector/InputBuffer.java b/java/org/apache/catalina/connector/InputBuffer.java
index 79090ee..bcf0571 100644
--- a/java/org/apache/catalina/connector/InputBuffer.java
+++ b/java/org/apache/catalina/connector/InputBuffer.java
@@ -236,22 +236,6 @@ public class InputBuffer extends Reader
public void setReadListener(ReadListener listener) {
coyoteRequest.setReadListener(listener);
-
- // The container is responsible for the first call to
- // listener.onDataAvailable(). If isReady() returns true, the container
- // needs to call listener.onDataAvailable() from a new thread. If
- // isReady() returns false, the socket will be registered for read and
- // the container will call listener.onDataAvailable() once data arrives.
- // Must call isFinished() first as a call to isReady() if the request
- // has been finished will register the socket for read interest and that
- // is not required.
- if (!coyoteRequest.isFinished() && isReady()) {
- coyoteRequest.action(ActionCode.DISPATCH_READ, null);
- if (!ContainerThreadMarker.isContainerThread()) {
- // Not on a container thread so need to execute the dispatch
- coyoteRequest.action(ActionCode.DISPATCH_EXECUTE, null);
- }
- }
}
diff --git a/java/org/apache/coyote/Request.java b/java/org/apache/coyote/Request.java
index e30a91a..4bee2b4 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -192,6 +192,22 @@ public final class Request {
}
this.listener = listener;
+
+ // The container is responsible for the first call to
+ // listener.onDataAvailable(). If isReady() returns true, the container
+ // needs to call listener.onDataAvailable() from a new thread. If
+ // isReady() returns false, the socket will be registered for read and
+ // the container will call listener.onDataAvailable() once data arrives.
+ // Must call isFinished() first as a call to isReady() if the request
+ // has been finished will register the socket for read interest and that
+ // is not required.
+ if (!isFinished() && isReady()) {
+ action(ActionCode.DISPATCH_READ, null);
+ if (!ContainerThreadMarker.isContainerThread()) {
+ // Not on a container thread so need to execute the dispatch
+ action(ActionCode.DISPATCH_EXECUTE, null);
+ }
+ }
}
public boolean isReady() {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[tomcat] 01/02: Refactor isReady() in preparation for fix of BZ
64771
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit b66b1f23f27ca1ac9da25e1d34f55d1bf8bb0b96
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Mar 22 21:43:27 2021 +0000
Refactor isReady() in preparation for fix of BZ 64771
https://bz.apache.org/bugzilla/show_bug.cgi?id=64771
---
java/org/apache/catalina/connector/InputBuffer.java | 6 +-----
java/org/apache/coyote/Request.java | 7 +++++++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/java/org/apache/catalina/connector/InputBuffer.java b/java/org/apache/catalina/connector/InputBuffer.java
index 9b8ebb7..79090ee 100644
--- a/java/org/apache/catalina/connector/InputBuffer.java
+++ b/java/org/apache/catalina/connector/InputBuffer.java
@@ -27,8 +27,6 @@ import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import jakarta.servlet.ReadListener;
import org.apache.catalina.security.SecurityUtil;
@@ -301,9 +299,7 @@ public class InputBuffer extends Reader
return true;
}
- AtomicBoolean result = new AtomicBoolean();
- coyoteRequest.action(ActionCode.NB_READ_INTEREST, result);
- return result.get();
+ return coyoteRequest.isReady();
}
diff --git a/java/org/apache/coyote/Request.java b/java/org/apache/coyote/Request.java
index 219eb5f..e30a91a 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -194,6 +194,13 @@ public final class Request {
this.listener = listener;
}
+ public boolean isReady() {
+ AtomicBoolean result = new AtomicBoolean();
+ action(ActionCode.NB_READ_INTEREST, result);
+ return result.get();
+ }
+
+
private final AtomicBoolean allDataReadEventSent = new AtomicBoolean(false);
public boolean sendAllDataReadEvent() {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org