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

Method sendMsg

stream.go:1123–1145  ·  view source on GitHub ↗
(m any, hdr []byte, payld mem.BufferSlice, dataLength, payloadLength int)

Source from the content-addressed store, hash-verified

1121}
1122
1123func (a *csAttempt) sendMsg(m any, hdr []byte, payld mem.BufferSlice, dataLength, payloadLength int) error {
1124 cs := a.cs
1125 if a.trInfo != nil {
1126 a.mu.Lock()
1127 if a.trInfo.tr != nil {
1128 a.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true)
1129 }
1130 a.mu.Unlock()
1131 }
1132 if err := a.transportStream.Write(hdr, payld, &transport.WriteOptions{Last: !cs.desc.ClientStreams}); err != nil {
1133 if !cs.desc.ClientStreams {
1134 // For non-client-streaming RPCs, we return nil instead of EOF on error
1135 // because the generated code requires it. finish is not called; RecvMsg()
1136 // will call it with the stream's status independently.
1137 return nil
1138 }
1139 return io.EOF
1140 }
1141 if a.statsHandler != nil {
1142 a.statsHandler.HandleRPC(a.ctx, outPayload(true, m, dataLength, payloadLength, time.Now()))
1143 }
1144 return nil
1145}
1146
1147func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) {
1148 cs := a.cs

Callers 1

SendMsgMethod · 0.80

Calls 7

outPayloadFunction · 0.85
NowMethod · 0.80
LazyLogMethod · 0.65
WriteMethod · 0.65
HandleRPCMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected