Attach the payload from ping frame to ping ack
This commit is contained in:
@ -86,7 +86,8 @@ func (flushIO) isItem() bool {
|
||||
}
|
||||
|
||||
type ping struct {
|
||||
ack bool
|
||||
ack bool
|
||||
data [8]byte
|
||||
}
|
||||
|
||||
func (ping) isItem() bool {
|
||||
|
@ -646,7 +646,9 @@ func (t *http2Client) handleSettings(f *http2.SettingsFrame) {
|
||||
}
|
||||
|
||||
func (t *http2Client) handlePing(f *http2.PingFrame) {
|
||||
t.controlBuf.put(&ping{true})
|
||||
pingAck := &ping{ack: true}
|
||||
copy(pingAck.data[:], f.Data[:])
|
||||
t.controlBuf.put(pingAck)
|
||||
}
|
||||
|
||||
func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) {
|
||||
@ -827,9 +829,7 @@ func (t *http2Client) controller() {
|
||||
case *flushIO:
|
||||
t.framer.flushWrite()
|
||||
case *ping:
|
||||
// TODO(zhaoq): Ack with all-0 data now. will change to some
|
||||
// meaningful content when this is actually in use.
|
||||
t.framer.writePing(true, i.ack, [8]byte{})
|
||||
t.framer.writePing(true, i.ack, i.data)
|
||||
default:
|
||||
grpclog.Printf("transport: http2Client.controller got unexpected item type %v\n", i)
|
||||
}
|
||||
|
@ -377,7 +377,9 @@ func (t *http2Server) handleSettings(f *http2.SettingsFrame) {
|
||||
}
|
||||
|
||||
func (t *http2Server) handlePing(f *http2.PingFrame) {
|
||||
t.controlBuf.put(&ping{true})
|
||||
pingAck := &ping{ack: true}
|
||||
copy(pingAck.data[:], f.Data[:])
|
||||
t.controlBuf.put(pingAck)
|
||||
}
|
||||
|
||||
func (t *http2Server) handleWindowUpdate(f *http2.WindowUpdateFrame) {
|
||||
@ -628,9 +630,7 @@ func (t *http2Server) controller() {
|
||||
case *flushIO:
|
||||
t.framer.flushWrite()
|
||||
case *ping:
|
||||
// TODO(zhaoq): Ack with all-0 data now. will change to some
|
||||
// meaningful content when this is actually in use.
|
||||
t.framer.writePing(true, i.ack, [8]byte{})
|
||||
t.framer.writePing(true, i.ack, i.data)
|
||||
default:
|
||||
grpclog.Printf("transport: http2Server.controller got unexpected item type %v\n", i)
|
||||
}
|
||||
|
@ -483,12 +483,12 @@ func TestServerContextCanceledOnClosedConnection(t *testing.T) {
|
||||
}
|
||||
cc.Close()
|
||||
select {
|
||||
case <-ss.Context().Done():
|
||||
if ss.Context().Err() != context.Canceled {
|
||||
t.Fatalf("ss.Context().Err() got %v, want %v", ss.Context().Err(), context.Canceled)
|
||||
}
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatalf("Failed to cancel the context of the sever side stream.")
|
||||
case <-ss.Context().Done():
|
||||
if ss.Context().Err() != context.Canceled {
|
||||
t.Fatalf("ss.Context().Err() got %v, want %v", ss.Context().Err(), context.Canceled)
|
||||
}
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatalf("Failed to cancel the context of the sever side stream.")
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user