MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / NewOneOffMuxConn

Function NewOneOffMuxConn

rpc/mux/pool.go:180–193  ·  view source on GitHub ↗

NewOneOffMuxConn wraps a raw conn as a mux.Stream to access a rpc/mux.Server. Combine this with rpc.NewClient: Dial conn with a corresponding dialer of RPC server Wrap conn as stream with NewOneOffMuxConn Call rpc.NewClient(stream) to get client.

(conn net.Conn)

Source from the content-addressed store, hash-verified

178// Wrap conn as stream with NewOneOffMuxConn
179// Call rpc.NewClient(stream) to get client.
180func NewOneOffMuxConn(conn net.Conn) (net.Conn, error) {
181 sess, err := mux.Client(conn, mux.DefaultConfig())
182 if err != nil {
183 return nil, errors.Wrapf(err, "create session to %s", conn.RemoteAddr())
184 }
185 stream, err := sess.OpenStream()
186 if err != nil {
187 return nil, errors.Wrapf(err, "open stream to %s", conn.RemoteAddr())
188 }
189 return &oneOffMuxConn{
190 Stream: stream,
191 sess: sess,
192 }, nil
193}
194
195// GetEx returns an one-off connection if it's anonymous, otherwise returns existing session
196// with Get.

Callers 7

PrepareMethod · 0.92
CommitMethod · 0.92
RollbackMethod · 0.92
TestIncCounterFunction · 0.85
TestIncCounterSimpleArgsFunction · 0.85
TestETLSBugFunction · 0.85
resetClientMethod · 0.85

Calls 1

RemoteAddrMethod · 0.80

Tested by 6

PrepareMethod · 0.74
CommitMethod · 0.74
RollbackMethod · 0.74
TestIncCounterFunction · 0.68
TestIncCounterSimpleArgsFunction · 0.68
TestETLSBugFunction · 0.68