Return ErrClosedPipe for writeTo

Return ErrClosedPipe for writeTo
This commit is contained in:
Miroslav Šedivý
2023-01-12 22:09:12 +01:00
committed by Steffen Vogel
parent 3fe1ae7c2b
commit d99a6fcb7c
+4
View File
@@ -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
}