MCPcopy
hub / github.com/grpc/grpc-go / greetWithSettings

Method greetWithSettings

test/servertester.go:98–128  ·  view source on GitHub ↗

greetWithSettings initiates the client's HTTP/2 connection with custom settings.

(settings ...http2.Setting)

Source from the content-addressed store, hash-verified

96
97// greetWithSettings initiates the client's HTTP/2 connection with custom settings.
98func (st *serverTester) greetWithSettings(settings ...http2.Setting) {
99 st.writePreface()
100 if len(settings) > 0 {
101 if err := st.fr.WriteSettings(settings...); err != nil {
102 st.t.Fatalf("Error writing initial SETTINGS frame from client to server: %v", err)
103 }
104 } else {
105 st.writeInitialSettings()
106 }
107 st.wantSettings()
108 st.writeSettingsAck()
109 for {
110 f, err := st.readFrame()
111 if err != nil {
112 st.t.Fatal(err)
113 }
114 switch f := f.(type) {
115 case *http2.WindowUpdateFrame:
116 // grpc's transport/http2_server sends this
117 // before the settings ack. The Go http2
118 // server uses a setting instead.
119 case *http2.SettingsFrame:
120 if f.IsAck() {
121 return
122 }
123 st.t.Fatalf("during greet, got non-ACK settings frame")
124 default:
125 st.t.Fatalf("during greet, unexpected frame type %T", f)
126 }
127 }
128}
129
130func (st *serverTester) writePreface() {
131 n, err := st.cc.Write([]byte(http2.ClientPreface))

Callers 2

greetMethod · 0.95

Calls 7

writePrefaceMethod · 0.95
writeInitialSettingsMethod · 0.95
wantSettingsMethod · 0.95
writeSettingsAckMethod · 0.95
readFrameMethod · 0.95
FatalfMethod · 0.65
FatalMethod · 0.65