SPDY: move probably blocking/long running flush out of synchronized block in StandardSession.syn(..)

Change-Id: I29b748495adb1fa48fab8dc130a8067ff3be6bc5
This commit is contained in:
Thomas Becker 2012-05-10 12:29:58 +02:00
parent ea557759b3
commit 5687aa8beb
1 changed files with 8 additions and 3 deletions

View File

@ -154,8 +154,9 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
int streamId = streamIds.getAndAdd(2);
SynStreamFrame synStream = new SynStreamFrame(version, synInfo.getFlags(), streamId, associatedStreamId, synInfo.getPriority(), synInfo.getHeaders());
IStream stream = createStream(synStream, listener, true);
control(stream, synStream, timeout, unit, handler, stream);
generateAndEnqueueControlFrame(stream, synStream, timeout, unit, handler, stream);
}
flush();
}
@Override
@ -724,6 +725,12 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
@Override
public <C> void control(IStream stream, ControlFrame frame, long timeout, TimeUnit unit, Handler<C> handler, C context)
{
generateAndEnqueueControlFrame(stream,frame,timeout,unit,handler,context);
flush();
}
private <C> void generateAndEnqueueControlFrame(IStream stream, ControlFrame frame, long timeout, TimeUnit unit, Handler<C> handler, C context)
{
try
{
@ -751,8 +758,6 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
else
append(frameBytes);
}
flush();
}
catch (Throwable x)
{