good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 2dc66c3f authored by Anmol Sethi's avatar Anmol Sethi
Browse files

Check whether the connection is closed before returning a write IO error

Closes #215
parent d34c89a3
No related branches found
No related tags found
No related merge requests found
......@@ -262,8 +262,14 @@ func (c *Conn) writeFrame(ctx context.Context, fin bool, flate bool, opcode opco
defer func() {
if err != nil {
err = fmt.Errorf("failed to write frame: %w", err)
select {
case <-c.closed:
err = c.closeErr
case <-ctx.Done():
err = ctx.Err()
}
c.close(err)
err = fmt.Errorf("failed to write frame: %w", err)
}
}()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment