func (x *bus) Shutdown(expire time.Time) { x.w.WaitAbsTimeout(expire) x.Lock() peers := x.peers x.peers = make(map[uint32]*busEp) x.Unlock() for id, peer := range peers { mangos.DrainChannel(peer.q, expire) close(peer.q) delete(peers, id) } }
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) } }
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) } }
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) } }