--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java Tue Jun 12 16:07:19 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java Tue Jun 12 17:35:00 2018 +0100
@@ -661,7 +661,13 @@
if (closed == true) return;
closed = true;
}
- Log.logError(t);
+ if (Log.errors()) {
+ if (!(t instanceof EOFException) || isActive()) {
+ Log.logError(t);
+ } else if (t != null) {
+ Log.logError("Shutting down connection: {0}", t.getMessage());
+ }
+ }
Throwable initialCause = this.cause;
if (initialCause == null) this.cause = t;
client2.deleteConnection(this);
@@ -1278,8 +1284,11 @@
@Override
public void onComplete() {
- if (debug.on()) debug.log("EOF");
- error = new EOFException("EOF reached while reading");
+ String msg = isActive()
+ ? "EOF reached while reading"
+ : "Idle connection closed by HTTP/2 peer";
+ if (debug.on()) debug.log(msg);
+ error = new EOFException(msg);
completed = true;
runOrSchedule();
}
@@ -1293,6 +1302,10 @@
}
}
+ synchronized boolean isActive() {
+ return numReservedClientStreams > 0 || numReservedServerStreams > 0;
+ }
+
@Override
public final String toString() {
return dbgString();