Wait for the goroutine to finish

This commit is contained in:
Vladimir Mihailenco 2020-12-06 14:55:00 +02:00
parent 2e398ada86
commit 2c9c526023
1 changed files with 2 additions and 0 deletions

View File

@ -316,6 +316,8 @@ func (c *baseClient) withConn(
select { select {
case <-done: case <-done:
_ = cn.Close() _ = cn.Close()
// Wait for the goroutine to finish and send something.
<-errc
err = ctx.Err() err = ctx.Err()
return err return err