( opt *Options, dialer func(ctx context.Context, network, addr string) (net.Conn, error), poolName string, )
| 726 | } |
| 727 | |
| 728 | func newConnPool( |
| 729 | opt *Options, |
| 730 | dialer func(ctx context.Context, network, addr string) (net.Conn, error), |
| 731 | poolName string, |
| 732 | ) (*pool.ConnPool, error) { |
| 733 | poolSize, err := util.SafeIntToInt32(opt.PoolSize, "PoolSize") |
| 734 | if err != nil { |
| 735 | return nil, err |
| 736 | } |
| 737 | |
| 738 | minIdleConns, err := util.SafeIntToInt32(opt.MinIdleConns, "MinIdleConns") |
| 739 | if err != nil { |
| 740 | return nil, err |
| 741 | } |
| 742 | |
| 743 | maxIdleConns, err := util.SafeIntToInt32(opt.MaxIdleConns, "MaxIdleConns") |
| 744 | if err != nil { |
| 745 | return nil, err |
| 746 | } |
| 747 | |
| 748 | maxActiveConns, err := util.SafeIntToInt32(opt.MaxActiveConns, "MaxActiveConns") |
| 749 | if err != nil { |
| 750 | return nil, err |
| 751 | } |
| 752 | |
| 753 | return pool.NewConnPool(&pool.Options{ |
| 754 | Dialer: func(ctx context.Context) (net.Conn, error) { |
| 755 | return dialer(ctx, opt.Network, opt.Addr) |
| 756 | }, |
| 757 | PoolFIFO: opt.PoolFIFO, |
| 758 | PoolSize: poolSize, |
| 759 | MaxConcurrentDials: opt.MaxConcurrentDials, |
| 760 | PoolTimeout: opt.PoolTimeout, |
| 761 | DialTimeout: opt.DialTimeout, |
| 762 | DialerRetries: opt.DialerRetries, |
| 763 | DialerRetryTimeout: opt.DialerRetryTimeout, |
| 764 | DialerRetryBackoff: opt.DialerRetryBackoff, |
| 765 | MinIdleConns: minIdleConns, |
| 766 | MaxIdleConns: maxIdleConns, |
| 767 | MaxActiveConns: maxActiveConns, |
| 768 | ConnMaxIdleTime: opt.ConnMaxIdleTime, |
| 769 | ConnMaxLifetime: opt.ConnMaxLifetime, |
| 770 | ConnMaxLifetimeJitter: opt.ConnMaxLifetimeJitter, |
| 771 | ReadBufferSize: opt.ReadBufferSize, |
| 772 | WriteBufferSize: opt.WriteBufferSize, |
| 773 | PushNotificationsEnabled: opt.Protocol == 3, |
| 774 | Name: poolName, |
| 775 | }), nil |
| 776 | } |
| 777 | |
| 778 | func newPubSubPool( |
| 779 | opt *Options, |
no test coverage detected