raft: fix panic in putVarint; varint can take up to 10 bytes for a 64bit integer.
parent
bb328d5aa5
commit
13ec81c87f
|
@ -79,7 +79,7 @@ func (n *Node) propose(t int64, data []byte) {
|
||||||
func (n *Node) Campaign() { n.Step(Message{From: n.sm.id, ClusterId: n.ClusterId(), Type: msgHup}) }
|
func (n *Node) Campaign() { n.Step(Message{From: n.sm.id, ClusterId: n.ClusterId(), Type: msgHup}) }
|
||||||
|
|
||||||
func (n *Node) InitCluster(clusterId int64) {
|
func (n *Node) InitCluster(clusterId int64) {
|
||||||
d := make([]byte, 8)
|
d := make([]byte, 10)
|
||||||
wn := binary.PutVarint(d, clusterId)
|
wn := binary.PutVarint(d, clusterId)
|
||||||
n.propose(ClusterInit, d[:wn])
|
n.propose(ClusterInit, d[:wn])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue