Skip to content

Commit

Permalink
Add check for Windows ECONNRESET
Browse files Browse the repository at this point in the history
  • Loading branch information
schmichael committed Dec 1, 2017
1 parent 13a69bd commit b4bacd6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions command/agent/fs_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,22 @@ func parseFramerErr(err error) error {
return nil
}

if strings.Contains(err.Error(), io.ErrClosedPipe.Error()) {
errMsg := err.Error()

if strings.Contains(errMsg, io.ErrClosedPipe.Error()) {
// The pipe check is for tests
return syscall.EPIPE
}

// The connection was closed by our peer
if strings.Contains(err.Error(), syscall.EPIPE.Error()) || strings.Contains(err.Error(), syscall.ECONNRESET.Error()) {
if strings.Contains(errMsg, syscall.EPIPE.Error()) || strings.Contains(errMsg, syscall.ECONNRESET.Error()) {
return syscall.EPIPE
}

// Windows version of ECONNRESET
//XXX(schmichael) I could find no existing error or constant to
// compare this against.
if strings.Contains(errMsg, "forcibly closed") {
return syscall.EPIPE
}

Expand Down

0 comments on commit b4bacd6

Please sign in to comment.