Issue 5310 - Review HTTP/2 GOAWAY handling.
Moved stream "close" event after returning from listener methods. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
949a89c15b
commit
62e17da2d0
|
@ -19,6 +19,7 @@
|
||||||
package org.eclipse.jetty.http2.client;
|
package org.eclipse.jetty.http2.client;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.MetaData;
|
import org.eclipse.jetty.http.MetaData;
|
||||||
|
import org.eclipse.jetty.http2.CloseState;
|
||||||
import org.eclipse.jetty.http2.ErrorCode;
|
import org.eclipse.jetty.http2.ErrorCode;
|
||||||
import org.eclipse.jetty.http2.FlowControlStrategy;
|
import org.eclipse.jetty.http2.FlowControlStrategy;
|
||||||
import org.eclipse.jetty.http2.HTTP2Session;
|
import org.eclipse.jetty.http2.HTTP2Session;
|
||||||
|
@ -62,7 +63,10 @@ public class HTTP2ClientSession extends HTTP2Session
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream.process(frame, Callback.NOOP);
|
stream.process(frame, Callback.NOOP);
|
||||||
|
boolean closed = stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED);
|
||||||
notifyHeaders(stream, frame);
|
notifyHeaders(stream, frame);
|
||||||
|
if (closed)
|
||||||
|
removeStream(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -328,9 +328,6 @@ public class HTTP2Stream extends IdleTimeout implements IStream, Callback, Dumpa
|
||||||
dataLength = length >= 0 ? length : Long.MIN_VALUE;
|
dataLength = length >= 0 ? length : Long.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateClose(frame.isEndStream(), CloseState.Event.RECEIVED))
|
|
||||||
session.removeStream(this);
|
|
||||||
|
|
||||||
callback.succeeded();
|
callback.succeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,10 +368,10 @@ public class HTTP2Stream extends IdleTimeout implements IStream, Callback, Dumpa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateClose(frame.isEndStream(), CloseState.Event.RECEIVED))
|
boolean closed = updateClose(frame.isEndStream(), CloseState.Event.RECEIVED);
|
||||||
session.removeStream(this);
|
|
||||||
|
|
||||||
notifyData(this, frame, callback);
|
notifyData(this, frame, callback);
|
||||||
|
if (closed)
|
||||||
|
session.removeStream(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onReset(ResetFrame frame, Callback callback)
|
private void onReset(ResetFrame frame, Callback callback)
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.MetaData;
|
import org.eclipse.jetty.http.MetaData;
|
||||||
|
import org.eclipse.jetty.http2.CloseState;
|
||||||
import org.eclipse.jetty.http2.ErrorCode;
|
import org.eclipse.jetty.http2.ErrorCode;
|
||||||
import org.eclipse.jetty.http2.FlowControlStrategy;
|
import org.eclipse.jetty.http2.FlowControlStrategy;
|
||||||
import org.eclipse.jetty.http2.HTTP2Session;
|
import org.eclipse.jetty.http2.HTTP2Session;
|
||||||
|
@ -109,8 +110,11 @@ public class HTTP2ServerSession extends HTTP2Session implements ServerParser.Lis
|
||||||
{
|
{
|
||||||
onStreamOpened(stream);
|
onStreamOpened(stream);
|
||||||
stream.process(frame, Callback.NOOP);
|
stream.process(frame, Callback.NOOP);
|
||||||
|
boolean closed = stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED);
|
||||||
Stream.Listener listener = notifyNewStream(stream, frame);
|
Stream.Listener listener = notifyNewStream(stream, frame);
|
||||||
stream.setListener(listener);
|
stream.setListener(listener);
|
||||||
|
if (closed)
|
||||||
|
removeStream(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +133,10 @@ public class HTTP2ServerSession extends HTTP2Session implements ServerParser.Lis
|
||||||
if (stream != null)
|
if (stream != null)
|
||||||
{
|
{
|
||||||
stream.process(frame, Callback.NOOP);
|
stream.process(frame, Callback.NOOP);
|
||||||
|
boolean closed = stream.updateClose(frame.isEndStream(), CloseState.Event.RECEIVED);
|
||||||
notifyHeaders(stream, frame);
|
notifyHeaders(stream, frame);
|
||||||
|
if (closed)
|
||||||
|
removeStream(stream);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue