func (c *_Conn) close() error {
	if r := recover(); r != nil {
		defer log.ErrLogger.Debug().Str("context", "conn.closing").Msgf("panic recovered '%v'", debug.Stack())
	}
	defer c.socket.Close()

	if !c.setClosed() {
		return errors.New("error disconnecting client")
	}

	// Signal all goroutines.
	close(c.closeC)
	c.closeW.Wait()
	// Unsubscribe from everything, no need to lock since each Unsubscribe is
	// already locked. Locking the 'Close()' would result in a deadlock.
	// Don't close clustered connection, their servers are not being shut down.
	if c.clnode == nil {
		for _, stat := range c.subs.All() {
			store.Subscription.Delete(c.clientID.Contract(), stat.ID, stat.Topic)
			// Decrement the subscription counter
			c.service.meter.Subscriptions.Dec(1)
		}
	}

	Globals.connCache.delete(c.connID)
	defer log.ConnLogger.Info().Str("context", "conn.close").Int64("connid", int64(c.connID)).Msg("conn closed")
	Globals.Cluster.connGone(c)
	close(c.send)

	c.batchManager.close()

	// Decrement the connection counter
	c.service.meter.Connections.Dec(1)

	return nil
}
// close terminates the connection.
close terminates the connection.
// close terminates the connection .
func (c *_Conn) close() error {
	if r := recover(); r != nil {
		defer log.ErrLogger.Debug().Str("context", "conn.closing").Msgf("panic recovered '%v'", debug.Stack())
	}
	defer c.socket.Close()
	if !c.setClosed() {
		return errors.New("error disconnecting client")
	}
	close(c.closeC)
	c.closeW.Wait()
	if c.clnode == nil {
		for _, stat := range c.subs.All() {
			store.Subscription.Delete(c.clientID.Contract(), stat.ID, stat.Topic)
			c.service.meter.Subscriptions.Dec(1)
		}
	}
	Globals.connCache.delete(c.connID)
	defer log.ConnLogger.Info().Str("context", "conn.close").Int64("connid", int64(c.connID)).Msg("conn closed")
	Globals.Cluster.connGone(c)
	close(c.send)
	c.batchManager.close()
	c.service.meter.Connections.Dec(1)
	return nil
}
func ( c * _Conn ) close ( ) error { if r := recover ( ) ; r != nil { defer log . ErrLogger . Debug ( ) . Str ( " " , " " ) . Msgf ( " " , debug . Stack ( ) ) } defer c . socket . Close ( ) if ! c . setClosed ( ) { return errors . New ( " " ) } close ( c . closeC ) c . closeW . Wait ( ) if c . clnode == nil { for _ , stat := range c . subs . All ( ) { store . Subscription . Delete ( c . clientID . Contract ( ) , stat . ID , stat . Topic ) c . service . meter . Subscriptions . Dec ( 1 ) } } Globals . connCache . delete ( c . connID ) defer log . ConnLogger . Info ( ) . Str ( " " , " " ) . Int64 ( " " , int64 ( c . connID ) ) . Msg ( " " ) Globals . Cluster . connGone ( c ) close ( c . send ) c . batchManager . close ( ) c . service . meter . Connections . Dec ( 1 ) return nil }
close terminates the connection.
close terminates the connection .
// Signal all goroutines. // Unsubscribe from everything, no need to lock since each Unsubscribe is // already locked. Locking the 'Close()' would result in a deadlock. // Don't close clustered connection, their servers are not being shut down. // Decrement the subscription counter // Decrement the connection counter