Close keepalive when recv() ends in client.go

This commit is contained in:
rcorniere 2020-03-10 18:01:47 +01:00
parent 6e84084bb3
commit d4960afc97

View file

@ -379,9 +379,8 @@ func (c *Client) sendWithWriter(writer io.Writer, packet []byte) error {
// Loop: Receive data from server // Loop: Receive data from server
func (c *Client) recv(keepaliveQuit chan<- struct{}) { func (c *Client) recv(keepaliveQuit chan<- struct{}) {
defer func() { defer close(keepaliveQuit)
close(keepaliveQuit)
}()
for { for {
val, err := stanza.NextPacket(c.transport.GetDecoder()) val, err := stanza.NextPacket(c.transport.GetDecoder())
if err != nil { if err != nil {