Close message channel before closing client.

Otherwise the call to "Close" might wait forever for the message processing
goroutine to finish.
This commit is contained in:
Joachim Bauch 2023-01-18 14:21:39 +01:00
parent 6395b87577
commit b7f221705a
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -254,8 +254,8 @@ func (c *Client) SendMessage(message WritableClientMessage) bool {
func (c *Client) ReadPump() {
defer func() {
c.Close()
close(c.messageChan)
c.Close()
}()
addr := c.RemoteAddr()