raft/rafttest: fix shadowed variable

This commit is contained in:
Gyu-Ho Lee 2015-12-12 05:54:02 -08:00
parent 4e06510280
commit 8696a1509c

View File

@ -85,7 +85,7 @@ func (rn *raftNetwork) send(m raftpb.Message) {
to = nil to = nil
} }
drop := rn.dropmap[conn{m.From, m.To}] drop := rn.dropmap[conn{m.From, m.To}]
delay := rn.delaymap[conn{m.From, m.To}] dl := rn.delaymap[conn{m.From, m.To}]
rn.mu.Unlock() rn.mu.Unlock()
if to == nil { if to == nil {
@ -94,9 +94,9 @@ func (rn *raftNetwork) send(m raftpb.Message) {
if drop != 0 && rand.Float64() < drop { if drop != 0 && rand.Float64() < drop {
return return
} }
// TODO: shall we delay without blocking the send call? // TODO: shall we dl without blocking the send call?
if delay.d != 0 && rand.Float64() < delay.rate { if dl.d != 0 && rand.Float64() < dl.rate {
rd := rand.Int63n(int64(delay.d)) rd := rand.Int63n(int64(dl.d))
time.Sleep(time.Duration(rd)) time.Sleep(time.Duration(rd))
} }