OkHttp: Make sure TransportListener.transportReady() can only be called once.

This commit is contained in:
Xudong Ma 2015-08-24 10:12:58 -07:00
parent 76b410de39
commit 485bc9c83c
1 changed files with 5 additions and 2 deletions

View File

@ -566,6 +566,7 @@ class OkHttpClientTransport implements ClientTransport {
@VisibleForTesting
class ClientFrameHandler implements FrameReader.Handler, Runnable {
FrameReader frameReader;
boolean firstSettings = true;
ClientFrameHandler(FrameReader frameReader) {
this.frameReader = frameReader;
@ -677,8 +678,10 @@ class OkHttpClientTransport implements ClientTransport {
settings, OkHttpSettingsUtil.INITIAL_WINDOW_SIZE);
outboundFlow.initialOutboundWindowSize(initialWindowSize);
}
listener.transportReady();
if (firstSettings) {
listener.transportReady();
firstSettings = false;
}
}
frameWriter.ackSettings(settings);