(opt ...Option)
| 38 | } |
| 39 | |
| 40 | func newRPCClient(opt ...Option) Client { |
| 41 | opts := NewOptions(opt...) |
| 42 | |
| 43 | p := pool.NewPool( |
| 44 | pool.Size(opts.PoolSize), |
| 45 | pool.TTL(opts.PoolTTL), |
| 46 | pool.Transport(opts.Transport), |
| 47 | pool.CloseTimeout(opts.PoolCloseTimeout), |
| 48 | ) |
| 49 | |
| 50 | rc := &rpcClient{ |
| 51 | opts: opts, |
| 52 | pool: p, |
| 53 | seq: 0, |
| 54 | } |
| 55 | rc.once.Store(false) |
| 56 | |
| 57 | c := Client(rc) |
| 58 | |
| 59 | // wrap in reverse |
| 60 | for i := len(opts.Wrappers); i > 0; i-- { |
| 61 | c = opts.Wrappers[i-1](c) |
| 62 | } |
| 63 | |
| 64 | return c |
| 65 | } |
| 66 | |
| 67 | func (r *rpcClient) newCodec(contentType string) (codec.NewCodec, error) { |
| 68 | if c, ok := r.opts.Codecs[contentType]; ok { |
no test coverage detected
searching dependent graphs…