Exemple #1
0
// markDown closes conn and temporarily marks the associated
// end point as unusable.
func (sdc *ShardConn) markDown(conn tabletconn.TabletConn, reason string) {
	sdc.mu.Lock()
	defer sdc.mu.Unlock()
	if conn != sdc.conn {
		return
	}
	sdc.balancer.MarkDown(conn.EndPoint().Uid, reason)

	go func(conn tabletconn.TabletConn) {
		danglingTabletConn.Add(1)
		conn.Close()
		danglingTabletConn.Add(-1)
	}(sdc.conn)
	sdc.conn = nil
}