// Close frees up caches and connections being maintained by the SDK
968008
func (sdk *FabricSDK) Close() {
	logger.Debug("SDK closing")
	if pvdr, ok := sdk.provider.LocalDiscoveryProvider().(closeable); ok {
		pvdr.Close()
	}
	if pvdr, ok := sdk.provider.ChannelProvider().(closeable); ok {
		pvdr.Close()
	}
	sdk.provider.InfraProvider().Close()
}
1246416
func (c *Connection) Close() error {
	c.lock.Lock()
	defer c.lock.Unlock()

	if c.client != nil {
		err := c.client.Close()
		for waiterID := range c.closeWaiters {
			close(c.closeWaiters[waiterID])
		}
		c.client = nil
		return err
	}
	return nil
}
1154073
func (c *Client) Close() error {
	if c.conn == nil {
		return ErrAlreadyClosed
	}
	err := c.conn.Close()
	c.conn = nil
	return err
}
883539
func (s *KVStore) Close() error {
	if s.db != nil {
		return s.db.Close()
	}
	return nil
}
1330102
func (c *Client) Close() error {
	c.once.Do(c.startLoop)
	c.quit <- struct{}{}
	close(c.msgs)
	<-c.shutdown
	return nil
}
266231
func (client *Client) Close() (err error) {
	client.Lock()
	defer client.Unlock()
	if client.conn != nil {
		err = client.conn.Close()
		client.conn = nil
	}
	return
}
1344245
func (s *memcacheStore) Close() {
	// Flush out sessions that were accessed from this store. No need locking, we're closing...
	// We could use Codec.SetMulti(), but sessions will contain at most 1 session like all the times.
	for _, sess := range s.sessions {
		s.setMemcacheSession(sess)
	}

	if s.onlyMemcache {
		return // Don't save to Datastore
	}

	if s.asyncDatastoreSave {
		go s.saveToDatastore()
	} else {
		s.saveToDatastore()
	}
}
305967
func (c *Client) Close() error {
	if c.isClosed() {
		return nil
	}
	atomic.StoreInt32(&c.closed, 1)
	if err := c.oscConn.Close(); err != nil {
		return err
	}
	close(c.errChan)
	close(c.doneChan)
	close(c.statusChan)
	close(c.gqueryTreeChan)
	return nil
}
1045302
func (ctn *Connection) Close() {
	ctn.closer.Do(func() {
		if ctn != nil && ctn.conn != nil {
			// deregister
			if ctn.node != nil {
				ctn.node.connectionCount.DecrementAndGet()
				atomic.AddInt64(&ctn.node.stats.ConnectionsClosed, 1)
			}

			if err := ctn.conn.Close(); err != nil {
				Logger.Warn(err.Error())
			}
			ctn.conn = nil
			ctn.dataBuffer = nil
		}
	})
}
1041788
func (c *Connector) Close() error {
	if c.Client != nil {
		return c.Close()
	}
	return nil
}
322242
func (k *Kite) Close() {
	k.Log.Info("Closing kite...")

	k.kontrol.Lock()
	if k.kontrol != nil && k.kontrol.Client != nil {
		k.kontrol.Close()
	}
	k.kontrol.Unlock()

	if k.listener != nil {
		k.listener.Close()
		k.listener = nil
	}

	k.mu.Lock()
	cache := k.verifyCache
	k.mu.Unlock()

	if cache != nil {
		cache.StopGC()
	}
}
373781
func (c *Conn) Close() error {
	if c != nil {
		return c.sqlite.Close()
	}
	return nil
}
690815
func (c Conn) Close() (err error) {
	if c.netConn == nil {
		return nil
	}
	err = c.netConn.Close()
	connPool.Put(c)
	c.netConn = nil
	c.readTimeout = 0
	c.writeTimeout = 0
	return
}
1028373
func (cc *CachingConnector) Close() {
	cc.lock.RLock()
	// Safety check to see if the connector has been closed. This represents a
	// bug in the calling code, but it's not good to panic here.
	if cc.janitorDone == nil {
		cc.lock.RUnlock()
		logger.Warn("Trying to close connector after already closed")
		return
	}
	cc.lock.RUnlock()
	logger.Debug("closing caching GRPC connector")

	select {
	case <-cc.janitorClosed:
		logger.Debug("janitor not running")
	default:
		logger.Debug("janitor running")
		cc.janitorDone <- true
		cc.waitgroup.Wait()
	}

	cc.lock.Lock()
	defer cc.lock.Unlock()

	if len(cc.index) > 0 {
		logger.Debugf("flushing connection cache with open connections [%d]", len(cc.index))
	} else {
		logger.Debug("flushing connection cache")
	}

	cc.flush()
	close(cc.janitorClosed)
	close(cc.janitorDone)
	cc.janitorDone = nil
}
723253
func (c *Conn) Close() {
	if c == nil {
		return
	}

	if c.conn != nil {
		c.conn.Close()
	}
}
552541
func (c *Client) Close() error {
	c.once.Do(func() { close(c.done) })
	c.Flush()
	return nil
}
879365
func (c SyncConn) Close() error {
	return errors.CombineErrs("error closing SyncConn", errors.NetworkError,
		c.SyncScanner.Close(), c.SyncSender.Close())
}