Skip to content

Commit c2f6f76

Browse files
committed
handle connection reset by peer
1 parent 057ac7d commit c2f6f76

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

pkg/controller/repository.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package controller
22

33
import (
44
"encoding/json"
5+
"errors"
56
"fmt"
67
"io"
78
"io/ioutil"
@@ -288,10 +289,13 @@ func (r *DefaultRepository) Command(name string, command SocketCommand) ([]byte,
288289
count, err := c.Read(buf)
289290
received = append(received, buf[:count]...)
290291
if err != nil {
291-
if err != io.EOF {
292-
return nil, err
292+
if errors.Is(err, syscall.ECONNRESET) {
293+
continue
294+
}
295+
if err == io.EOF {
296+
break
293297
}
294-
break
298+
return nil, err
295299
}
296300
}
297301

0 commit comments

Comments
 (0)