mirror of
https://github.com/zrepl/zrepl.git
synced 2025-06-19 17:27:46 +02:00
parent
8a5af2f80e
commit
a78c854404
@ -8,6 +8,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
@ -295,11 +296,22 @@ func (c *Conn) Shutdown(deadline time.Time) error {
|
|||||||
|
|
||||||
closeWire := func(step string) error {
|
closeWire := func(step string) error {
|
||||||
// TODO SetLinger(0) or similiar (we want RST frames here, not FINS)
|
// TODO SetLinger(0) or similiar (we want RST frames here, not FINS)
|
||||||
if closeErr := c.nc.Close(); closeErr != nil {
|
closeErr := c.nc.Close()
|
||||||
prom.ShutdownCloseErrors.WithLabelValues("close").Inc()
|
if closeErr == nil {
|
||||||
return closeErr
|
return nil
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
|
// TODO go1.13: https://github.com/zrepl/zrepl/issues/190
|
||||||
|
// https://github.com/golang/go/issues/8319
|
||||||
|
// (use errors.Is(closeErr, syscall.ECONNRESET))
|
||||||
|
if pe, ok := closeErr.(*net.OpError); ok && pe.Err == syscall.ECONNRESET {
|
||||||
|
// connection reset by peer on FreeBSD, see https://github.com/zrepl/zrepl/issues/190
|
||||||
|
// We know from kernel code reading that the FD behind c.nc is closed, so let's not consider this an error
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
prom.ShutdownCloseErrors.WithLabelValues("close").Inc()
|
||||||
|
return closeErr
|
||||||
}
|
}
|
||||||
|
|
||||||
hardclose := func(err error, step string) error {
|
hardclose := func(err error, step string) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user