func (c *Connection) connectionError(site string, err error) error {
	var closeLogFields LogFields
	if err == io.EOF {
		closeLogFields = LogFields{{"reason", "network connection EOF"}}
	} else {
		closeLogFields = LogFields{
			{"reason", "connection error"},
			ErrField(err),
		}
	}

	c.stopHealthCheck()
	err = c.logConnectionError(site, err)
	c.close(closeLogFields...)

	// On any connection error, notify the exchanges of this error.
	if c.stoppedExchanges.CAS(false, true) {
		c.outbound.stopExchanges(err)
		c.inbound.stopExchanges(err)
	}

	// checkExchanges will close the connection due to stoppedExchanges.
	c.checkExchanges()
	return err
}
func (c *Connection) connectionError(site string, err error) error {
	var closeLogFields LogFields
	if err == io.EOF {
		closeLogFields = LogFields{{"reason", "network connection EOF"}}
	} else {
		closeLogFields = LogFields{
			{"reason", "connection error"},
			ErrField(err),
		}
	}

	c.stopHealthCheck()
	err = c.logConnectionError(site, err)
	c.close(closeLogFields...)

	
	if c.stoppedExchanges.CAS(false, true) {
		c.outbound.stopExchanges(err)
		c.inbound.stopExchanges(err)
	}

	
	c.checkExchanges()
	return err
}
func ( c * Connection ) connectionError ( site string , err error ) error { var closeLogFields LogFields if err == io . EOF { closeLogFields = LogFields { { " " , " " } } } else { closeLogFields = LogFields { { " " , " " } , ErrField ( err ) , } } c . stopHealthCheck ( ) err = c . logConnectionError ( site , err ) c . close ( closeLogFields ... ) // On any connection error, notify the exchanges of this error. if c . stoppedExchanges . CAS ( false , true ) { c . outbound . stopExchanges ( err ) c . inbound . stopExchanges ( err ) } // checkExchanges will close the connection due to stoppedExchanges. c . checkExchanges ( ) return err }
// connectionError handles a connection level error
connectionError handles a connection level error