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

Method NewStream

stream.go:167–176  ·  view source on GitHub ↗

NewStream creates a new Stream for the client side. This is typically called by generated code. ctx is used for the lifetime of the stream. To ensure resources are not leaked due to the stream returned, one of the following actions must be performed: 1. Call Close on the ClientConn. 2. Cancel the

(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption)

Source from the content-addressed store, hash-verified

165// If none of the above happen, a goroutine and a context will be leaked, and grpc
166// will not call the optionally-configured stats handler with a stats.End message.
167func (cc *ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) {
168 // allow interceptor to see all applicable call options, which means those
169 // configured as defaults from dial option as well as per-call options
170 opts = combine(cc.dopts.callOptions, opts)
171
172 if cc.dopts.streamInt != nil {
173 return cc.dopts.streamInt(ctx, desc, cc, method, newClientStream, opts...)
174 }
175 return newClientStream(ctx, desc, cc, method, opts...)
176}
177
178// NewClientStream is a wrapper for ClientConn.NewStream.
179func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) {

Callers

nothing calls this directly

Calls 2

combineFunction · 0.85
newClientStreamFunction · 0.85

Tested by

no test coverage detected