int headlen = 0;
ByteBuffer head = null;
Map<Object, Object> env = null;
+ Request req = null;
Client(SocketChannel sk) {
this.sk = sk;
if((events & SelectionKey.OP_READ) != 0) {
if((env == null) && !readhead())
return;
- Request req = new Request(env, sk);
- submit(() -> EventServer.this.handle(req, handler));
+ req = new Request(env, sk);
handoff = true;
}
if(Driver.current().time() > (lastread + timeout))
}
public void close() {
+ if(req != null)
+ submit(() -> EventServer.this.handle(req, handler));
if(!handoff) {
try {
sk.close();