| 1121 | } |
| 1122 | |
| 1123 | func (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 | |
| 1147 | func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { |
| 1148 | cs := a.cs |