Skip to content

Commit

Permalink
Return ErrClosedPipe for writeTo.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k1o committed Dec 8, 2022
1 parent ea00dc7 commit 8b6af54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions candidate_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ func (c *candidateBase) close() error {
func (c *candidateBase) writeTo(raw []byte, dst Candidate) (int, error) {
n, err := c.conn.WriteTo(raw, dst.addr())
if err != nil {
// If the connection is closed, we should return the error
if errors.Is(err, io.ErrClosedPipe) {
return n, err
}
c.agent().log.Infof("%s: %v", errSendPacket, err)
return n, nil
}
Expand Down

0 comments on commit 8b6af54

Please sign in to comment.