Exemple #1
0
func (x *surveyor) Shutdown(expire time.Time) {

	x.w.WaitAbsTimeout(expire)
	x.Lock()
	peers := x.peers
	x.peers = make(map[uint32]*surveyorP)
	x.Unlock()

	for id, peer := range peers {
		delete(peers, id)
		mangos.DrainChannel(peer.q, expire)
		close(peer.q)
	}
}
Exemple #2
0
func (r *rep) Shutdown(expire time.Time) {

	r.w.WaitAbsTimeout(expire)

	r.Lock()
	peers := r.eps
	r.eps = make(map[uint32]*repEp)
	r.Unlock()

	for id, peer := range peers {
		delete(peers, id)
		mangos.DrainChannel(peer.q, expire)
		close(peer.q)
	}
}
Exemple #3
0
func (p *pub) Shutdown(expire time.Time) {

	p.w.WaitAbsTimeout(expire)

	p.Lock()
	peers := p.eps
	p.eps = make(map[uint32]*pubEp)
	p.Unlock()

	for id, peer := range peers {
		mangos.DrainChannel(peer.q, expire)
		close(peer.q)
		delete(peers, id)
	}
}
Exemple #4
0
func (x *resp) Shutdown(expire time.Time) {
	peers := make(map[uint32]*respPeer)
	x.w.WaitAbsTimeout(expire)
	x.Lock()
	for id, peer := range x.peers {
		delete(x.peers, id)
		peers[id] = peer
	}
	x.Unlock()

	for id, peer := range peers {
		delete(peers, id)
		mangos.DrainChannel(peer.q, expire)
		close(peer.q)
	}
}