mirror of https://github.com/go-redis/redis.git
Add DisableHelloCmd options
This commit is contained in:
parent
21bd40a47e
commit
3805610dff
|
@ -144,6 +144,10 @@ type Options struct {
|
||||||
|
|
||||||
// Disable set-lib on connect. Default is false.
|
// Disable set-lib on connect. Default is false.
|
||||||
DisableIndentity bool
|
DisableIndentity bool
|
||||||
|
|
||||||
|
// Disable Hello on connect. Default is false.
|
||||||
|
// Hello is used to check the server version,but in Enterprise environment with twproxy,it will cause error,return EOF panic.
|
||||||
|
DisableHelloCmd bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opt *Options) init() {
|
func (opt *Options) init() {
|
||||||
|
|
2
redis.go
2
redis.go
|
@ -285,6 +285,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
||||||
protocol = 3
|
protocol = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !c.opt.DisableHelloCmd {
|
||||||
// for redis-server versions that do not support the HELLO command,
|
// for redis-server versions that do not support the HELLO command,
|
||||||
// RESP2 will continue to be used.
|
// RESP2 will continue to be used.
|
||||||
if err := conn.Hello(ctx, protocol, username, password, "").Err(); err == nil {
|
if err := conn.Hello(ctx, protocol, username, password, "").Err(); err == nil {
|
||||||
|
@ -299,6 +300,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
||||||
// difficult to rely on error strings to determine all results.
|
// difficult to rely on error strings to determine all results.
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if !c.opt.DisableIndentity {
|
if !c.opt.DisableIndentity {
|
||||||
libName := ""
|
libName := ""
|
||||||
libVer := Version()
|
libVer := Version()
|
||||||
|
|
Loading…
Reference in New Issue