MCPcopy
hub / github.com/micro/go-micro / Close

Method Close

client/rpc_stream.go:151–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149}
150
151func (r *rpcStream) Close() error {
152 r.Lock()
153
154 select {
155 case <-r.closed:
156 r.Unlock()
157 return nil
158 default:
159 close(r.closed)
160 r.Unlock()
161
162 // send the end of stream message
163 if r.sendEOS {
164 // no need to check for error
165 //nolint:errcheck,gosec
166 r.codec.Write(&codec.Message{
167 Id: r.id,
168 Target: r.request.Service(),
169 Method: r.request.Method(),
170 Endpoint: r.request.Endpoint(),
171 Type: codec.Error,
172 Error: lastStreamResponseError,
173 }, nil)
174 }
175
176 err := r.codec.Close()
177
178 rerr := r.Error()
179 if r.close && rerr == nil {
180 rerr = errors.New("connection header set to close")
181 }
182 // release the connection
183 r.release(rerr)
184
185 return err
186 }
187}

Callers 2

callMethod · 0.95
streamMethod · 0.95

Calls 7

ErrorMethod · 0.95
releaseMethod · 0.80
WriteMethod · 0.65
ServiceMethod · 0.65
MethodMethod · 0.65
EndpointMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected