Skip to content

Commit

Permalink
gh-30 update ?
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknow0 committed Apr 7, 2024
1 parent e65c3e4 commit edf0396
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ protected void onFree() throws IOException { // for override
*/
protected final void readFrom(SocketChannel channel, ByteBuffer buf) throws InterruptedException, IOException {
int l;
lastRead = System.currentTimeMillis();
while (true) {
l = channel.read(buf);
if (l == -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ public boolean closed(long now, boolean stop) {

if (pendingWrite.isEmpty() && keepAliveIdle > 0) {
long e = now - keepAliveIdle;
if (lastRead() <= e && lastWrite() <= e)
if (lastRead() <= e && lastWrite() <= e) {
logger.info(" keep alive idle reached");
return true;
}
}

// TODO check request timeout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Http11Processor(HttpConnection co) {
}

@Override
public final void process() { // nothing to do
public final void process() {
if (exec.isDone())
exec = co.submit(new Http11Worker(co));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ public final void doStart() throws IOException, InterruptedException {
out.flush();
}

close = keepAliveIdle == 0 || "close".equalsIgnoreCase(req.getHeader("connection"));
close = keepAliveIdle == 0 || !"keep-alive".equalsIgnoreCase(req.getHeader("connection"));
res.setHeader("connection", close ? "close" : "keep-alive");
}

@Override
protected void doDone() {
if ("close".equalsIgnoreCase(res.getHeader("connection")))
if (!"keep-alive".equalsIgnoreCase(res.getHeader("connection")))
co.getOut().close();
}

Expand Down

0 comments on commit edf0396

Please sign in to comment.