From 9df0e935c037988e64e30498b6ecf3c7a99411a2 Mon Sep 17 00:00:00 2001 From: iamqizhao Date: Mon, 1 Jun 2015 13:02:31 -0700 Subject: [PATCH] fix a race --- transport/http2_client.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/transport/http2_client.go b/transport/http2_client.go index a32d416c..169a80dd 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -579,12 +579,13 @@ func (t *http2Client) handleSettings(f *http2.SettingsFrame) { } t.mu.Lock() reset := t.streamsQuota != nil + if !reset { + t.streamsQuota = newQuotaPool(int(v)) + } ms := t.maxStreams t.maxStreams = int(v) t.mu.Unlock() - if !reset { - t.streamsQuota = newQuotaPool(int(v)) - } else { + if reset { t.streamsQuota.reset(int(v) - ms) } case http2.SettingInitialWindowSize: