Exemple #1
0
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)
}
Exemple #2
0
func (p *pub) AddEndpoint(ep mangos.Endpoint) {
	p.init.Do(func() {
		p.w.Add()
		go p.sender()
	})
	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)
}