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

Method put

internal/transport/transport.go:84–106  ·  view source on GitHub ↗
(r recvMsg)

Source from the content-addressed store, hash-verified

82}
83
84func (b *recvBuffer) put(r recvMsg) {
85 b.mu.Lock()
86 if b.err != nil {
87 // drop the buffer on the floor. Since b.err is not nil, any subsequent reads
88 // will always return an error, making this buffer inaccessible.
89 r.buffer.Free()
90 b.mu.Unlock()
91 // An error had occurred earlier, don't accept more
92 // data or errors.
93 return
94 }
95 b.err = r.err
96 if len(b.backlog) == 0 {
97 select {
98 case b.c <- r:
99 b.mu.Unlock()
100 return
101 default:
102 }
103 }
104 b.backlog = append(b.backlog, r)
105 b.mu.Unlock()
106}
107
108func (b *recvBuffer) load() {
109 b.mu.Lock()

Calls 3

FreeMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45