summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/hashicorp/memberlist
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/memberlist')
-rw-r--r--vendor/github.com/hashicorp/memberlist/memberlist.go4
-rw-r--r--vendor/github.com/hashicorp/memberlist/net.go2
-rw-r--r--vendor/github.com/hashicorp/memberlist/state.go14
-rw-r--r--vendor/github.com/hashicorp/memberlist/transport.go2
4 files changed, 13 insertions, 9 deletions
diff --git a/vendor/github.com/hashicorp/memberlist/memberlist.go b/vendor/github.com/hashicorp/memberlist/memberlist.go
index bdf333b43..e9084f9fd 100644
--- a/vendor/github.com/hashicorp/memberlist/memberlist.go
+++ b/vendor/github.com/hashicorp/memberlist/memberlist.go
@@ -639,7 +639,9 @@ func (m *Memberlist) Shutdown() error {
// Shut down the transport first, which should block until it's
// completely torn down. If we kill the memberlist-side handlers
// those I/O handlers might get stuck.
- m.transport.Shutdown()
+ if err := m.transport.Shutdown(); err != nil {
+ m.logger.Printf("[ERR] Failed to shutdown transport: %v", err)
+ }
// Now tear down everything else.
atomic.StoreInt32(&m.shutdown, 1)
diff --git a/vendor/github.com/hashicorp/memberlist/net.go b/vendor/github.com/hashicorp/memberlist/net.go
index 58e1fce20..a4330c4d2 100644
--- a/vendor/github.com/hashicorp/memberlist/net.go
+++ b/vendor/github.com/hashicorp/memberlist/net.go
@@ -1059,7 +1059,7 @@ func (m *Memberlist) readUserMsg(bufConn io.Reader, dec *codec.Decoder) error {
// operations, given the deadline. The bool return parameter is true if we
// we able to round trip a ping to the other node.
func (m *Memberlist) sendPingAndWaitForAck(addr string, ping ping, deadline time.Time) (bool, error) {
- conn, err := m.transport.DialTimeout(addr, m.config.TCPTimeout)
+ conn, err := m.transport.DialTimeout(addr, deadline.Sub(time.Now()))
if err != nil {
// If the node is actually dead we expect this to fail, so we
// shouldn't spam the logs with it. After this point, errors
diff --git a/vendor/github.com/hashicorp/memberlist/state.go b/vendor/github.com/hashicorp/memberlist/state.go
index 29fe5f1cf..f51692de0 100644
--- a/vendor/github.com/hashicorp/memberlist/state.go
+++ b/vendor/github.com/hashicorp/memberlist/state.go
@@ -251,10 +251,17 @@ func (m *Memberlist) probeNode(node *nodeState) {
nackCh := make(chan struct{}, m.config.IndirectChecks+1)
m.setProbeChannels(ping.SeqNo, ackCh, nackCh, probeInterval)
+ // Mark the sent time here, which should be after any pre-processing but
+ // before system calls to do the actual send. This probably over-reports
+ // a bit, but it's the best we can do. We had originally put this right
+ // after the I/O, but that would sometimes give negative RTT measurements
+ // which was not desirable.
+ sent := time.Now()
+
// Send a ping to the node. If this node looks like it's suspect or dead,
// also tack on a suspect message so that it has a chance to refute as
// soon as possible.
- deadline := time.Now().Add(probeInterval)
+ deadline := sent.Add(probeInterval)
addr := node.Address()
if node.State == stateAlive {
if err := m.encodeAndSendMsg(addr, pingMsg, &ping); err != nil {
@@ -284,11 +291,6 @@ func (m *Memberlist) probeNode(node *nodeState) {
}
}
- // Mark the sent time here, which should be after any pre-processing and
- // system calls to do the actual send. This probably under-reports a bit,
- // but it's the best we can do.
- sent := time.Now()
-
// Arrange for our self-awareness to get updated. At this point we've
// sent the ping, so any return statement means the probe succeeded
// which will improve our health until we get to the failure scenarios
diff --git a/vendor/github.com/hashicorp/memberlist/transport.go b/vendor/github.com/hashicorp/memberlist/transport.go
index ca0a66083..6ce55ea47 100644
--- a/vendor/github.com/hashicorp/memberlist/transport.go
+++ b/vendor/github.com/hashicorp/memberlist/transport.go
@@ -17,7 +17,7 @@ type Packet struct {
// Timestamp is the time when the packet was received. This should be
// taken as close as possible to the actual receipt time to help make an
- // accurate RTT measurements during probes.
+ // accurate RTT measurement during probes.
Timestamp time.Time
}