func (r *Replica) send2b(msg *gpaxosproto.M_2b, w *bufio.Writer) { w.WriteByte(gpaxosproto.M2B) msg.Marshal(w) for _, cid := range msg.Cids { cmd := r.commands[cid] cmd.Marshal(w) } w.Flush() }
func (r *Replica) bcast2b(msg *gpaxosproto.M_2b) { defer func() { if err := recover(); err != nil { dlog.Println("Commit bcast failed:", err) } }() for rid, w := range r.PeerWriters { if int32(rid) == r.Id { continue } w.WriteByte(gpaxosproto.M2B) msg.Marshal(w) for _, cid := range msg.Cids { cmd := r.commands[cid] cmd.Marshal(w) } w.Flush() } }