Properly linking stream object with HEADERS frame.

This commit is contained in:
Simone Bordet 2014-06-11 08:56:23 +02:00
parent 3c6663ff21
commit 7c5492acad
3 changed files with 10 additions and 6 deletions

View File

@ -22,7 +22,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jetty.http2.api.Session;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.util.Callback;
@ -31,23 +30,25 @@ public class HTTP2Stream implements IStream
{
private final AtomicReference<ConcurrentMap<String, Object>> attributes = new AtomicReference<>();
private final ISession session;
private final HeadersFrame frame;
private Listener listener;
public HTTP2Stream(ISession session)
public HTTP2Stream(ISession session, HeadersFrame frame)
{
this.session = session;
this.frame = frame;
}
@Override
public int getId()
{
return 0;
return frame.getStreamId();
}
@Override
public Session getSession()
public ISession getSession()
{
return null;
return session;
}
@Override

View File

@ -23,6 +23,9 @@ import org.eclipse.jetty.http2.frames.DataFrame;
public interface IStream extends Stream
{
@Override
public ISession getSession();
public void setListener(Listener listener);
public boolean process(DataFrame frame);

View File

@ -60,7 +60,7 @@ public class HTTP2ServerSession extends HTTP2Session implements ServerParser.Lis
// TODO: handle duplicate streams
// TODO: handle empty headers
IStream stream = new HTTP2Stream(this);
IStream stream = new HTTP2Stream(this, frame);
IStream existing = putIfAbsent(stream);
if (existing == null)
{