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)
| 168 | // by the server. This can be called multiple times. |
| 169 | // This should not be called parallel to other data writes. |
| 170 | func (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 | |
| 183 | func (s *ServerStream) requestRead(n int) { |
| 184 | s.st.adjustWindow(s, uint32(n)) |