Skip to content

Commit

Permalink
gh-24 remove some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknow0 committed Nov 25, 2023
1 parent 6438fc8 commit c130ec6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private boolean fillRequest(ServletRequestImpl req) throws InterruptedException
last = i + 2;

map = new HashMap<>();
while ((i = BuffersUtils.indexOf(pendingRead, CRLF, last, MAX_HEADER_SIZE)) > 0) {
while ((i = BuffersUtils.indexOf(pendingRead, CRLF, last, MAX_HEADER_SIZE)) > last) {
int c = BuffersUtils.indexOf(pendingRead, COLON, last, i - last);
if (c < 0) {
error(HttpError.BAD_REQUEST);
Expand All @@ -204,7 +204,7 @@ private boolean fillRequest(ServletRequestImpl req) throws InterruptedException
last = i + 2;
}
req.setHeaders(map);
pendingRead.skip(2);
pendingRead.skip(last+2);
return true;
}

Expand Down Expand Up @@ -299,19 +299,15 @@ public boolean closed(long now, boolean stop) {
if (stop)
return !running;

if (isClosed()) {
logger.info("isClosed {}", this);
if (isClosed())
return true;
}
if (running)
return false;

if (keepAliveIdle > 0) {
long e = now - keepAliveIdle;
if (lastRead() <= e && lastWrite() <= e) {
logger.info("read: {}, write: {}, e: {}", lastRead(), lastWrite(), e);
if (lastRead() <= e && lastWrite() <= e)
return true;
}
}

// TODO check request timeout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public final void free() throws InterruptedException, IOException {
pendingWrite.clear();
pendingRead.clear();
onFree();
// pool.free(this);
pool.free(this);
}

@SuppressWarnings("resource")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.nio.channels.SelectionKey;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.function.Function;

Expand Down Expand Up @@ -45,7 +45,7 @@ public NIOServer(NIOWorkers workers, NIOServerListener listener) throws IOExcept
super("NIOServer", 0);
this.workers = workers;
this.listener = listener == null ? NIOServerListener.NOP : listener;
this.pools = new HashMap<>();
this.pools = new IdentityHashMap<>();
}

/**
Expand Down

0 comments on commit c130ec6

Please sign in to comment.