intermediate change

This commit is contained in:
Mahak Mukhi
2017-01-27 11:15:56 -08:00
parent 49d2a88c27
commit b2448f6c9b

View File

@ -1075,36 +1075,39 @@ func (t *http2Client) controller() {
} }
isPingSent := false isPingSent := false
keepalivePing := &ping{data: [8]byte{}} keepalivePing := &ping{data: [8]byte{}}
cchan := t.controlBuf.get()
wchan := nil
for { for {
select { select {
case i := <-t.controlBuf.get(): case i := <-cchan:
t.controlBuf.load() t.controlBuf.load()
select { wchan = t.writableChan
case <-t.writableChan: cchan = nil
switch i := i.(type) { continue
case *windowUpdate: case <-wchan:
t.framer.writeWindowUpdate(true, i.streamID, i.increment) switch i := i.(type) {
case *settings: case *windowUpdate:
if i.ack { t.framer.writeWindowUpdate(true, i.streamID, i.increment)
t.framer.writeSettingsAck(true) case *settings:
t.applySettings(i.ss) if i.ack {
} else { t.framer.writeSettingsAck(true)
t.framer.writeSettings(true, i.ss...) t.applySettings(i.ss)
} } else {
case *resetStream: t.framer.writeSettings(true, i.ss...)
t.framer.writeRSTStream(true, i.streamID, i.code)
case *flushIO:
t.framer.flushWrite()
case *ping:
t.framer.writePing(true, i.ack, i.data)
default:
grpclog.Printf("transport: http2Client.controller got unexpected item type %v\n", i)
} }
t.writableChan <- 0 case *resetStream:
continue t.framer.writeRSTStream(true, i.streamID, i.code)
case <-t.shutdownChan: case *flushIO:
return t.framer.flushWrite()
case *ping:
t.framer.writePing(true, i.ack, i.data)
default:
grpclog.Printf("transport: http2Client.controller got unexpected item type %v\n", i)
} }
wchan <- 0
wchan = nil
cchan = t.controlBuf.get()
continue
case <-timer.C: case <-timer.C:
t.mu.Lock() t.mu.Lock()
ns := len(t.activeStreams) ns := len(t.activeStreams)