Mark ACCOUNT_REQUIRED error as permanent connection failure
There's no point in retrying to connect in this case.
This commit is contained in:
parent
fd9a935f3e
commit
1620344f0a
17
upstream.go
17
upstream.go
@ -57,7 +57,14 @@ func (err registrationError) Reason() string {
|
||||
func (err registrationError) Temporary() bool {
|
||||
// Only return false if we're 100% sure that fixing the error requires a
|
||||
// network configuration change
|
||||
return err.Command != irc.ERR_PASSWDMISMATCH && err.Command != irc.ERR_ERRONEUSNICKNAME
|
||||
switch err.Command {
|
||||
case irc.ERR_PASSWDMISMATCH, irc.ERR_ERRONEUSNICKNAME:
|
||||
return false
|
||||
case "FAIL":
|
||||
return err.Params[1] != "ACCOUNT_REQUIRED"
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
type upstreamChannel struct {
|
||||
@ -1618,11 +1625,15 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
||||
})
|
||||
})
|
||||
case "FAIL":
|
||||
var command string
|
||||
if err := parseMessageParams(msg, &command); err != nil {
|
||||
var command, code string
|
||||
if err := parseMessageParams(msg, &command, &code); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !uc.registered && command == "*" && code == "ACCOUNT_REQUIRED" {
|
||||
return registrationError{msg}
|
||||
}
|
||||
|
||||
if dc, _ := uc.dequeueCommand(command); dc != nil && downstreamID == 0 {
|
||||
downstreamID = dc.id
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user