func (m *Memberlist) encodeBroadcastNotify(node string, msgType messageType, msg interface{}, notify chan struct{}) {
	buf, err := encode(msgType, msg)
	if err != nil {
		m.logger.Printf("[ERR] memberlist: Failed to encode message for broadcast: %s", err)
	} else {
		m.queueBroadcast(node, buf.Bytes(), notify)
	}
}
encodeBroadcastNotify encodes a message and enqueues it for broadcast
and notifies the given channel when transmission is finished. Fails
silently if there is an encoding error.
package memberlist
type memberlistBroadcast struct {
	node   string
	msg    []byte
	notify chan struct{}
}
func (b *memberlistBroadcast) Invalidates(other Broadcast) bool {
	mb, ok := other.(*memberlistBroadcast)
	if !ok {
		return false
	}
	return b.node == mb.node
}
func (b *memberlistBroadcast) Message() []byte {
	return b.msg
}
func (b *memberlistBroadcast) Finished() {
	select {
	case b.notify <- struct{}{}:
	default:
	}
}
func (m *Memberlist) encodeAndBroadcast(node string, msgType messageType, msg interface{}) {
	m.encodeBroadcastNotify(node, msgType, msg, nil)
}