Skip to content

Commit

Permalink
temporaryError simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
fclairamb committed Mar 3, 2024
1 parent a4627d3 commit 1dfdf82
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"net"
"os"
"syscall"
"time"

Expand Down Expand Up @@ -203,14 +202,9 @@ func (server *FtpServer) Listen() error {
}

func temporaryError(err net.Error) bool {
if opErr, ok := err.(*net.OpError); ok {
if sysErr, ok := opErr.Err.(*os.SyscallError); ok {
if errno, ok := sysErr.Err.(syscall.Errno); ok {
if errno == syscall.ECONNABORTED ||
errno == syscall.ECONNRESET {
return true
}
}
if syscallErrNo := new(syscall.Errno); errors.As(err, syscallErrNo) {
if *syscallErrNo == syscall.ECONNABORTED || *syscallErrNo == syscall.ECONNRESET {
return true
}
}

Expand Down

0 comments on commit 1dfdf82

Please sign in to comment.