Beispiel #1
0
func (r *Replica) SendMsgNoFlush(peerId int32, code uint8, msg fastrpc.Serializable) (retErr error) {
	defer func() error {
		if err := recover(); err != nil {
			r.Alive[peerId] = false
			retErr = errors.New("SendNoFlush Error")
			SendError = true
		}
		return nil
	}()
	SendError = false
	if !r.Alive[peerId] {
		SendError = true
		return errors.New("Trying to send to a replica that may not be alive")
	}
	r.PeerWLocks[peerId].Lock()
	defer r.PeerWLocks[peerId].Unlock()
	w := r.PeerWriters[peerId]
	w.WriteByte(code)
	msg.Marshal(w)
	return nil
}
Beispiel #2
0
func (r *Replica) SendMsgNoFlush(peerId int32, code uint8, msg fastrpc.Serializable) {
	w := r.PeerWriters[peerId]
	w.WriteByte(code)
	msg.Marshal(w)
}