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

Method SetTrailer

internal/transport/server_stream.go:170–181  ·  view source on GitHub ↗

SetTrailer sets the trailer metadata which will be sent with the RPC status by the server. This can be called multiple times. This should not be called parallel to other data writes.

(md metadata.MD)

Source from the content-addressed store, hash-verified

168// by the server. This can be called multiple times.
169// This should not be called parallel to other data writes.
170func (s *ServerStream) SetTrailer(md metadata.MD) error {
171 if md.Len() == 0 {
172 return nil
173 }
174 if s.getState() == streamDone {
175 return ErrIllegalHeaderWrite
176 }
177 s.hdrMu.Lock()
178 s.trailer = metadata.Join(s.trailer, md)
179 s.hdrMu.Unlock()
180 return nil
181}
182
183func (s *ServerStream) requestRead(n int) {
184 s.st.adjustWindow(s, uint32(n))

Callers

nothing calls this directly

Implementers 1

serverStreamstream.go

Calls 5

JoinFunction · 0.92
LenMethod · 0.65
getStateMethod · 0.45
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected