ok2c commented on code in PR #606:
URL:
https://github.com/apache/httpcomponents-core/pull/606#discussion_r2809557474
##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java:
##########
@@ -519,6 +538,27 @@ public final void onOutput() throws HttpException,
IOException {
}
if (connState.compareTo(ConnectionHandshake.ACTIVE) <= 0 &&
remoteSettingState == SettingsHandshake.ACKED) {
+ final long validateAfterInactivityMillis = validateAfterInactivity
!= null ? validateAfterInactivity.toMilliseconds() : 0;
+ final long effectiveValidateAfterInactivityMillis =
validateAfterInactivityMillis > 0
+ ? Math.max(validateAfterInactivityMillis,
VALIDATE_AFTER_INACTIVITY_GRANULARITY_MILLIS)
+ : 0;
+ final boolean hasBeenIdleTooLong =
effectiveValidateAfterInactivityMillis > 0
+ && System.currentTimeMillis() - lastActivityTime >
effectiveValidateAfterInactivityMillis;
+
+ if (hasBeenIdleTooLong && ioSession.hasCommands() &&
pingHandlers.isEmpty()) {
Review Comment:
@arturobernalg I think the above can be simplified as
```
final long t = TimeValue.isPositive(validateAfterInactivity) ?
Math.max(validateAfterInactivity.toMilliseconds(),
VALIDATE_AFTER_INACTIVITY_GRANULARITY_MILLIS) : 0;
final boolean hasBeenIdleTooLong = t > 0 && System.currentTimeMillis() -
lastActivityTime > t;
```
Please squash the commits, tidy up javadocs, update the pull request title
and merge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]