示例#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)
}
示例#2
0
文件: pub.go 项目: laszlo-kiss/mangos
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)
}