// Disassociates a Channel from a Nick.
13046
func (nk *nick) delChannel(ch *channel) {
	if _, ok := nk.chans[ch]; ok {
		delete(nk.chans, ch)
		delete(nk.lookup, ch.name)
	} else {
		logging.Warn("Nick.delChannel(): %s not on %s.", nk.nick, ch.name)
	}
}
384904
func Close() {
	setupMutex.Lock()
	defer setupMutex.Unlock()

	select {
	case <-identityAllocatorInitialized:
		// This means the channel was closed and therefore the IdentityAllocator == nil will never be true
	default:
		if IdentityAllocator == nil {
			log.Panic("Close() called without calling InitIdentityAllocator() first")
		}
	}

	IdentityAllocator.Delete()
	watcher.stop()
	IdentityAllocator = nil
	identityAllocatorInitialized = make(chan struct{})
	localIdentities = nil
}
370175
func (s *StanServer) sendDeleteChannelRequest(c *channel) {
	iopm := &ioPendingMsg{c: c, dc: true}
	s.ioChannel <- iopm
}
969308
func (r *amqpRequester) Teardown() error {
	if err := r.channel.Close(); err != nil {
		return err
	}
	return r.conn.Close()
}
104096
func (s *StanServer) handleChannelDelete(c *channel) {
	delete := false
	cs := s.channels
	cs.Lock()
	a := c.activity
	if a.preventDelete || a.deleteInProgress || c.ss.hasActiveSubs() {
		if s.debug {
			s.log.Debugf("Channel %q cannot be deleted: preventDelete=%v inProgress=%v hasActiveSubs=%v",
				c.name, a.preventDelete, a.deleteInProgress, c.ss.hasActiveSubs())
		}
		c.stopDeleteTimer()
	} else {
		elapsed := time.Since(a.last)
		if elapsed >= a.maxInactivity {
			if s.debug {
				s.log.Debugf("Channel %q is being deleted", c.name)
			}
			c.stopDeleteTimer()
			// Leave in map for now, but mark as deleted. If we removed before
			// completion of the removal, a new lookup could re-create while
			// in the process of deleting it.
			a.deleteInProgress = true
			delete = true
		} else {
			var next time.Duration
			if elapsed < 0 {
				next = a.maxInactivity
			} else {
				// elapsed < a.maxInactivity
				next = a.maxInactivity - elapsed
			}
			if s.debug {
				s.log.Debugf("Channel %q cannot be deleted now, reset timer to fire in %v",
					c.name, next)
			}
			c.resetDeleteTimer(next)
		}
	}
	cs.Unlock()
	if delete {
		if testDeleteChannel {
			time.Sleep(time.Second)
		}
		if s.isClustered {
			s.replicateDeleteChannel(c.name)
		} else {
			s.processDeleteChannel(c.name)
		}
	}
}
1277556
func (c *ReactionsAddCall) Channel(channel string) *ReactionsAddCall {
	c.channel = channel
	return c
}
895938
func Resume(channel int) {
	_channel := (C.int)(channel)
	C.Mix_Resume(_channel)
}
769818
func (f *fundingManager) deleteChannelOpeningState(chanPoint *wire.OutPoint) error {
	return f.cfg.Wallet.Cfg.Database.Update(func(tx *bbolt.Tx) error {
		bucket := tx.Bucket(channelOpeningStateBucket)
		if bucket == nil {
			return fmt.Errorf("Bucket not found")
		}

		var outpointBytes bytes.Buffer
		if err := writeOutpoint(&outpointBytes, chanPoint); err != nil {
			return err
		}

		return bucket.Delete(outpointBytes.Bytes())
	})
}
572175
func (nk *nick) Nick() *Nick {
	n := &Nick{
		Nick:     nk.nick,
		Ident:    nk.ident,
		Host:     nk.host,
		Name:     nk.name,
		Modes:    nk.modes.Copy(),
		Channels: make(map[string]*ChanPrivs),
	}
	for c, cp := range nk.chans {
		n.Channels[c.name] = cp.Copy()
	}
	return n
}
215088
func (u *User) Move(channel *Channel) {
	packet := MumbleProto.UserState{
		Session:   &u.Session,
		ChannelId: &channel.ID,
	}
	u.client.Conn.WriteProto(&packet)
}
1309377
func FromChannel(source <-chan interface{}) Query {
	return Query{
		Iterate: func() Iterator {
			return func() (item interface{}, ok bool) {
				item, ok = <-source
				return
			}
		},
	}
}
941889
func (s *ChannelService) Close() {
	logger.Debugf("Closing discovery service for channel [%s]", s.channelID)
	s.service.Close()
}
1124593
func (s *State) PrivateChannel(channelID string) (*Channel, error) {
	return s.Channel(channelID)
}
4924
func NewAggregateFromChannel(errCh chan error, ctx context.Context) error {
	var errs []error

Loop:
	for {
		select {
		case err, ok := <-errCh:
			if !ok { // the channel is closed, time to exit
				break Loop
			}
			errs = append(errs, err)
		case <-ctx.Done():
			break Loop
		}
	}

	return NewAggregate(errs...)
}
1122081
func (gc *gossipChannel) LeaveChannel() {
	gc.Lock()
	defer gc.Unlock()

	atomic.StoreInt32(&gc.leftChannel, 1)

	var chaincodes []*proto.Chaincode
	var height uint64
	if prevMsg := gc.stateInfoMsg; prevMsg != nil {
		chaincodes = prevMsg.GetStateInfo().Properties.Chaincodes
		height = prevMsg.GetStateInfo().Properties.LedgerHeight
	}
	gc.updateProperties(height, chaincodes, true)
}
66789
func (ch *Channel) IsOn(nk string) (*ChanPrivs, bool) {
	cp, ok := ch.Nicks[nk]
	return cp, ok
}
1103481
func (c *ReactionsRemoveCall) Channel(channel string) *ReactionsRemoveCall {
	c.channel = channel
	return c
}