Closed kgdev closed 9 years ago
func (s Session) writeMessage(message envelope) { select { case s.output <- message: default: s.melody.errorHandler(s, errors.New("Message buffer full")) } }
Here s.output <- message could panic if s.output is already closed, which causes the whole application to exit.
It looks like the problem is:
panic: [stderr] send on closed channel [stderr] goroutine 72 [running]: [stderr] ....melody.(_Session).writeMessage(0xc8203c6f60, 0xc820342000) .... melody.(_Session).ping
func (s *Session) ping() { s.writeMessage(&envelope{t: websocket.PingMessage, msg: []byte{}}) }
We should use s.writeRaw instead of s.writeMessage in ping().
Nice catch, thank you :+1:
func (s Session) writeMessage(message envelope) { select { case s.output <- message: default: s.melody.errorHandler(s, errors.New("Message buffer full")) } }
Here s.output <- message could panic if s.output is already closed, which causes the whole application to exit.
It looks like the problem is:
panic: [stderr] send on closed channel [stderr] goroutine 72 [running]: [stderr] ....melody.(_Session).writeMessage(0xc8203c6f60, 0xc820342000) .... melody.(_Session).ping
func (s *Session) ping() { s.writeMessage(&envelope{t: websocket.PingMessage, msg: []byte{}}) }
We should use s.writeRaw instead of s.writeMessage in ping().