mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-01 03:30:34 +00:00
8179273: sun.net.httpserver.LeftOverInputStream should stop attempting to drain the stream when the server is stopped
Reviewed-by: chegar
This commit is contained in:
parent
bbd1ecb6b7
commit
f9ad6da8b5
@ -41,8 +41,8 @@ import com.sun.net.httpserver.spi.*;
|
||||
* isEOF() returns true, when all expected bytes have been read
|
||||
*/
|
||||
abstract class LeftOverInputStream extends FilterInputStream {
|
||||
ExchangeImpl t;
|
||||
ServerImpl server;
|
||||
final ExchangeImpl t;
|
||||
final ServerImpl server;
|
||||
protected boolean closed = false;
|
||||
protected boolean eof = false;
|
||||
byte[] one = new byte [1];
|
||||
@ -109,6 +109,9 @@ abstract class LeftOverInputStream extends FilterInputStream {
|
||||
int bufSize = 2048;
|
||||
byte[] db = new byte [bufSize];
|
||||
while (l > 0) {
|
||||
if (server.isFinishing()) {
|
||||
break;
|
||||
}
|
||||
long len = readImpl (db, 0, bufSize);
|
||||
if (len == -1) {
|
||||
eof = true;
|
||||
|
||||
@ -179,6 +179,10 @@ class ServerImpl implements TimeSource {
|
||||
return httpsConfig;
|
||||
}
|
||||
|
||||
public final boolean isFinishing() {
|
||||
return finished;
|
||||
}
|
||||
|
||||
public void stop (int delay) {
|
||||
if (delay < 0) {
|
||||
throw new IllegalArgumentException ("negative delay parameter");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user