protect event schedule race
This commit is contained in:
parent
752973931e
commit
af70c4bd48
|
@ -291,7 +291,7 @@ public class HttpChannelState
|
|||
protected Action unhandle()
|
||||
{
|
||||
Action action;
|
||||
boolean schedule_timeout=false;
|
||||
AsyncContextEvent schedule_event=null;
|
||||
boolean read_interested=false;
|
||||
|
||||
if(DEBUG)
|
||||
|
@ -344,9 +344,9 @@ public class HttpChannelState
|
|||
_state=State.ASYNC_IO;
|
||||
action = Action.WRITE_CALLBACK;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
schedule_timeout=true;
|
||||
schedule_event=_event;
|
||||
read_interested=_asyncReadUnready;
|
||||
_state=State.ASYNC_WAIT;
|
||||
action = Action.WAIT;
|
||||
|
@ -354,7 +354,7 @@ public class HttpChannelState
|
|||
break;
|
||||
|
||||
case EXPIRING:
|
||||
schedule_timeout=true;
|
||||
schedule_event=_event;
|
||||
_state=State.ASYNC_WAIT;
|
||||
action = Action.WAIT;
|
||||
break;
|
||||
|
@ -372,8 +372,8 @@ public class HttpChannelState
|
|||
}
|
||||
}
|
||||
|
||||
if (schedule_timeout)
|
||||
scheduleTimeout();
|
||||
if (schedule_event!=null)
|
||||
scheduleTimeout(schedule_event);
|
||||
if (read_interested)
|
||||
_channel.asyncReadFillInterested();
|
||||
return action;
|
||||
|
@ -611,11 +611,11 @@ public class HttpChannelState
|
|||
_channel.execute(_channel);
|
||||
}
|
||||
|
||||
protected void scheduleTimeout()
|
||||
protected void scheduleTimeout(AsyncContextEvent event)
|
||||
{
|
||||
Scheduler scheduler = _channel.getScheduler();
|
||||
if (scheduler!=null && _timeoutMs>0)
|
||||
_event.setTimeoutTask(scheduler.schedule(_event,_timeoutMs,TimeUnit.MILLISECONDS));
|
||||
event.setTimeoutTask(scheduler.schedule(event,_timeoutMs,TimeUnit.MILLISECONDS));
|
||||
}
|
||||
|
||||
protected void cancelTimeout()
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.eclipse.jetty.server;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.Reference;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.WritePendingException;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
@ -70,7 +69,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
private final BlockingReadCallback _blockingReadCallback = new BlockingReadCallback();
|
||||
private final AsyncReadCallback _asyncReadCallback = new AsyncReadCallback();
|
||||
private final SendCallback _sendCallback = new SendCallback();
|
||||
|
||||
|
||||
/**
|
||||
* Get the current connection that this thread is dispatched to.
|
||||
* Note that a thread may be processing a request asynchronously and
|
||||
|
@ -200,7 +199,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
{
|
||||
if (_requestBuffer == null)
|
||||
_requestBuffer = _bufferPool.acquire(getInputBufferSize(), REQUEST_BUFFER_DIRECT);
|
||||
return _requestBuffer;
|
||||
return _requestBuffer;
|
||||
}
|
||||
|
||||
public boolean isRequestBufferEmpty()
|
||||
|
@ -221,10 +220,10 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
{
|
||||
// Fill the request buffer (if needed)
|
||||
int filled = fillRequestBuffer();
|
||||
|
||||
|
||||
// Parse the request buffer
|
||||
boolean handle = parseRequestBuffer();
|
||||
|
||||
|
||||
// Handle close parser
|
||||
if (_parser.isClose())
|
||||
{
|
||||
|
@ -258,7 +257,6 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
LOG.debug("{} onFillable exit {}", this, _channel.getState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Fill and parse data looking for content
|
||||
|
|
|
@ -126,7 +126,6 @@ public class HttpInputIntegrationTest
|
|||
// HTTP/2 Connector
|
||||
ServerConnector http2Connector =
|
||||
new ServerConnector(__server,ssl,/*TODO alpn,h2,*/ h1);
|
||||
http2Connector.setPort(8443);
|
||||
__server.addConnector(http2Connector);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue