func (x *push) AddEndpoint(ep mangos.Endpoint) { pe := &pushEp{ep: ep, cq: make(chan struct{})} x.Lock() x.eps[ep.GetID()] = pe x.Unlock() x.w.Add() go x.sender(pe) go mangos.NullRecv(ep) }
func (p *pub) AddEndpoint(ep mangos.Endpoint) { depth := 16 if i, err := p.sock.GetOption(mangos.OptionWriteQLen); err == nil { depth = i.(int) } pe := &pubEp{ep: ep, p: p, q: make(chan *mangos.Message, depth)} pe.w.Init() p.Lock() p.eps[ep.GetID()] = pe p.Unlock() pe.w.Add() go pe.peerSender() go mangos.NullRecv(ep) }