downstream: move multi-upstream name handling to loadNetwork
This commit is contained in:
parent
bed50c10ce
commit
d9468b983f
@ -1311,6 +1311,18 @@ func (dc *downstreamConn) register(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (dc *downstreamConn) loadNetwork(ctx context.Context) error {
|
func (dc *downstreamConn) loadNetwork(ctx context.Context) error {
|
||||||
|
if dc.networkName == "*" {
|
||||||
|
if !dc.srv.Config().MultiUpstream {
|
||||||
|
return ircError{&irc.Message{
|
||||||
|
Command: irc.ERR_PASSWDMISMATCH,
|
||||||
|
Params: []string{dc.nick, fmt.Sprintf("Multi-upstream mode is disabled on this server")},
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
dc.networkName = ""
|
||||||
|
dc.isMultiUpstream = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if dc.networkName == "" {
|
if dc.networkName == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1372,17 +1384,6 @@ func (dc *downstreamConn) welcome(ctx context.Context) error {
|
|||||||
remoteAddr := dc.conn.RemoteAddr().String()
|
remoteAddr := dc.conn.RemoteAddr().String()
|
||||||
dc.logger = &prefixLogger{dc.srv.Logger, fmt.Sprintf("user %q: downstream %q: ", dc.user.Username, remoteAddr)}
|
dc.logger = &prefixLogger{dc.srv.Logger, fmt.Sprintf("user %q: downstream %q: ", dc.user.Username, remoteAddr)}
|
||||||
|
|
||||||
if dc.networkName == "*" {
|
|
||||||
if !dc.srv.Config().MultiUpstream {
|
|
||||||
return ircError{&irc.Message{
|
|
||||||
Command: irc.ERR_PASSWDMISMATCH,
|
|
||||||
Params: []string{dc.nick, fmt.Sprintf("Multi-upstream mode is disabled on this server")},
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
dc.networkName = ""
|
|
||||||
dc.isMultiUpstream = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: doing this might take some time. We should do it in dc.register
|
// TODO: doing this might take some time. We should do it in dc.register
|
||||||
// instead, but we'll potentially be adding a new network and this must be
|
// instead, but we'll potentially be adding a new network and this must be
|
||||||
// done in the user goroutine.
|
// done in the user goroutine.
|
||||||
|
Loading…
Reference in New Issue
Block a user