Stop message handler goroutine when connection closes
This commit is contained in:
parent
e55760a1a5
commit
f497e248f1
2 changed files with 13 additions and 6 deletions
|
@ -12,7 +12,12 @@ func handleMessages(irc *IRC, session *Session) {
|
|||
userBuffers := make(map[string][]string)
|
||||
var motd MOTD
|
||||
|
||||
for msg := range irc.Messages {
|
||||
for {
|
||||
msg, ok := <-irc.Messages
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
switch msg.Command {
|
||||
case NICK:
|
||||
session.sendJSON("nick", Nick{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue