Don't do unnecessary clock skew check in IPAM

This commit is contained in:
Bryan Boreham committed 2016-03-10 11:41:47 +00:00
1 parent 3ad9d8e785
commit a57335738d
2 files changed
+1 -18

No files matched your search

+1 -6
View File
@@ -469,7 +469,7 @@ func (alloc *Allocator) OnGossipBroadcast(sender mesh.PeerName, msg []byte) (mes
type gossipState struct {
// We send a timstamp along with the information to be
// gossipped in order to detect skewed clocks
// gossipped for backwards-compatibility (previously to detect skewed clocks)
Now int64
Nicknames map[mesh.PeerName]string
@@ -673,11 +673,6 @@ func (alloc *Allocator) update(sender mesh.PeerName, msg []byte) error {
return err
}
deltat := time.Unix(data.Now, 0).Sub(alloc.now())
if deltat > time.Hour || -deltat > time.Hour {
return fmt.Errorf("clock skew of %v detected, ignoring update", deltat)
}
// Merge nicknames
for peer, nickname := range data.Nicknames {
alloc.nicknames[peer] = nickname
-12
View File
@@ -577,18 +577,6 @@ func TestAllocatorFuzz(t *testing.T) {
})
}
func TestGossipSkew(t *testing.T) {
alloc1, _ := makeAllocatorWithMockGossip(t, "01:00:00:01:00:00", "10.0.1.0/22", 2)
defer alloc1.Stop()
alloc2, _ := makeAllocatorWithMockGossip(t, "02:00:00:02:00:00", "10.0.1.0/22", 2)
alloc2.now = func() time.Time { return time.Now().Add(time.Hour * 2) }
defer alloc2.Stop()
if _, err := alloc1.OnGossipBroadcast(alloc2.ourName, alloc2.Encode()); err == nil {
t.Fail()
}
}
func TestSpaceRequest(t *testing.T) {
const (
container1 = "cont-1"