Stop creating new goroutines for irc.Connect() since it doesnt block anymore
This commit is contained in:
parent
adcf12e1fa
commit
ebdb382706
|
@ -69,20 +69,17 @@ func reconnect() {
|
|||
i.Password = server.Password
|
||||
i.Realname = server.Realname
|
||||
|
||||
go func(server storage.Server) {
|
||||
i.Connect(server.Address)
|
||||
session.setIRC(i.Host, i)
|
||||
i.Connect(server.Address)
|
||||
session.setIRC(i.Host, i)
|
||||
go handleIRC(i, session)
|
||||
|
||||
go handleIRC(i, session)
|
||||
|
||||
var joining []string
|
||||
for _, channel := range channels {
|
||||
if channel.Server == server.Address {
|
||||
joining = append(joining, channel.Name)
|
||||
}
|
||||
var joining []string
|
||||
for _, channel := range channels {
|
||||
if channel.Server == server.Address {
|
||||
joining = append(joining, channel.Name)
|
||||
}
|
||||
i.Join(joining...)
|
||||
}(server)
|
||||
}
|
||||
i.Join(joining...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,20 +99,18 @@ func handleWS(conn *websocket.Conn) {
|
|||
session.setIRC(data.Server[:idx], i)
|
||||
}
|
||||
|
||||
go func() {
|
||||
i.Connect(data.Server)
|
||||
go handleIRC(i, session)
|
||||
i.Connect(data.Server)
|
||||
go handleIRC(i, session)
|
||||
|
||||
session.user.AddServer(storage.Server{
|
||||
Name: data.Name,
|
||||
Address: i.Host,
|
||||
TLS: data.TLS,
|
||||
Password: data.Password,
|
||||
Nick: data.Nick,
|
||||
Username: data.Username,
|
||||
Realname: data.Realname,
|
||||
})
|
||||
}()
|
||||
session.user.AddServer(storage.Server{
|
||||
Name: data.Name,
|
||||
Address: i.Host,
|
||||
TLS: data.TLS,
|
||||
Password: data.Password,
|
||||
Nick: data.Nick,
|
||||
Username: data.Username,
|
||||
Realname: data.Realname,
|
||||
})
|
||||
} else {
|
||||
log.Println(addr, "already connected to", data.Server)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue