processAuthError generally processing for auth errors. We want to do retries unless we get the same error again. This allows us for instance to swap credentials and have the app reconnect, but if nothing is changing we should bail. This function will return true if the connection should be closed, f
(err error)
| 3950 | // This function will return true if the connection should be closed, false otherwise. |
| 3951 | // Connection lock is held on entry |
| 3952 | func (nc *Conn) processAuthError(err error) bool { |
| 3953 | nc.err = err |
| 3954 | if !nc.initc { |
| 3955 | if asyncErrorCB := nc.Opts.AsyncErrorCB; asyncErrorCB != nil { |
| 3956 | nc.ach.push(func() { asyncErrorCB(nc, nil, err) }) |
| 3957 | } |
| 3958 | } |
| 3959 | // We should give up if we tried twice on this server and got the |
| 3960 | // same error. This behavior can be modified using IgnoreAuthErrorAbort. |
| 3961 | if nc.current.lastErr == err && !nc.Opts.IgnoreAuthErrorAbort { |
| 3962 | nc.ar = true |
| 3963 | } else { |
| 3964 | nc.current.lastErr = err |
| 3965 | } |
| 3966 | return nc.ar |
| 3967 | } |
| 3968 | |
| 3969 | // flusher is a separate Go routine that will process flush requests for the write |
| 3970 | // bufio. This allows coalescing of writes to the underlying socket. |
no test coverage detected