diff options
author | Valery Piashchynski <[email protected]> | 2020-12-25 00:55:15 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-25 00:55:15 +0300 |
commit | f52156e76cf02e0b3de993fa6d9ba0d2f4e52001 (patch) | |
tree | 025c6c60930844bd10ac776e90266d679e3c1606 /plugins/http/errors.go | |
parent | 1bc3db2ea9b95edd0101676d7bfd75df3782c3bd (diff) |
Initial commit of experiment
Diffstat (limited to 'plugins/http/errors.go')
-rw-r--r-- | plugins/http/errors.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/http/errors.go b/plugins/http/errors.go new file mode 100644 index 00000000..fb8762ef --- /dev/null +++ b/plugins/http/errors.go @@ -0,0 +1,25 @@ +// +build !windows + +package http + +import ( + "errors" + "net" + "os" + "syscall" +) + +// Broken pipe +var errEPIPE = errors.New("EPIPE(32) -> connection reset by peer") + +// handleWriteError just check if error was caused by aborted connection on linux +func handleWriteError(err error) error { + if netErr, ok2 := err.(*net.OpError); ok2 { + if syscallErr, ok3 := netErr.Err.(*os.SyscallError); ok3 { + if syscallErr.Err == syscall.EPIPE { + return errEPIPE + } + } + } + return err +} |