Merge pull request #206 from iamqizhao/master

fix a race introduced by pr #205
This commit is contained in:
Qi Zhao
2015-06-01 13:13:34 -07:00

View File

@ -579,12 +579,13 @@ func (t *http2Client) handleSettings(f *http2.SettingsFrame) {
} }
t.mu.Lock() t.mu.Lock()
reset := t.streamsQuota != nil reset := t.streamsQuota != nil
if !reset {
t.streamsQuota = newQuotaPool(int(v))
}
ms := t.maxStreams ms := t.maxStreams
t.maxStreams = int(v) t.maxStreams = int(v)
t.mu.Unlock() t.mu.Unlock()
if !reset { if reset {
t.streamsQuota = newQuotaPool(int(v))
} else {
t.streamsQuota.reset(int(v) - ms) t.streamsQuota.reset(int(v) - ms)
} }
case http2.SettingInitialWindowSize: case http2.SettingInitialWindowSize: