larksuite-oapi/src/main/java/com/larksuite/oapi/okhttp3_14/internal/connection/RealConnection.java
void trackFailure(@Nullable IOException e) {
    assert (!Thread.holdsLock(connectionPool));
    synchronized (connectionPool) {
      if (e instanceof StreamResetException) {
        ErrorCode errorCode = ((StreamResetException) e).errorCode;
        if (errorCode == ErrorCode.REFUSED_STREAM) {
          // Retry REFUSED_STREAM errors once on the same connection.
          refusedStreamCount++;
          if (refusedStreamCount > 1) {
            noNewExchanges = true;
            routeFailureCount++;
          }
        } else if (errorCode != ErrorCode.CANCEL) {
          // Keep the connection for CANCEL errors. Everything else wants a fresh connection.
          noNewExchanges = true;
          routeFailureCount++;
        }
      } else if (!isMultiplexed() || e instanceof ConnectionShutdownException) {
        noNewExchanges = true;

        // If this route hasn't completed a call, avoid it for new connections.
        if (successCount == 0) {
          if (e != null) {
            connectionPool.connectFailed(route, e);
          }
          routeFailureCount++;
        }
      }
    }
  }
/**
   * Track a failure using this connection. This may prevent both the connection and its route from
   * being used for future exchanges.
   */
Track a failure using this connection. This may prevent both the connection and its route from
being used for future exchanges.
Track a failure using this connection . This may prevent both the connection and its route from being used for future exchanges .
void trackFailure(@Nullable IOException e) {
    assert (!Thread.holdsLock(connectionPool));
    synchronized (connectionPool) {
      if (e instanceof StreamResetException) {
        ErrorCode errorCode = ((StreamResetException) e).errorCode;
        if (errorCode == ErrorCode.REFUSED_STREAM) {
          refusedStreamCount++;
          if (refusedStreamCount > 1) {
            noNewExchanges = true;
            routeFailureCount++;
          }
        } else if (errorCode != ErrorCode.CANCEL) {
          noNewExchanges = true;
          routeFailureCount++;
        }
      } else if (!isMultiplexed() || e instanceof ConnectionShutdownException) {
        noNewExchanges = true;
        if (successCount == 0) {
          if (e != null) {
            connectionPool.connectFailed(route, e);
          }
          routeFailureCount++;
        }
      }
    }
  }
void trackFailure ( @ Nullable IOException e ) { assert ( ! Thread . holdsLock ( connectionPool ) ) ; synchronized ( connectionPool ) { if ( e instanceof StreamResetException ) { ErrorCode errorCode = ( ( StreamResetException ) e ) . errorCode ; if ( errorCode == ErrorCode . REFUSED_STREAM ) { refusedStreamCount ++ ; if ( refusedStreamCount > 1 ) { noNewExchanges = true ; routeFailureCount ++ ; } } else if ( errorCode != ErrorCode . CANCEL ) { noNewExchanges = true ; routeFailureCount ++ ; } } else if ( ! isMultiplexed ( ) || e instanceof ConnectionShutdownException ) { noNewExchanges = true ; if ( successCount == 0 ) { if ( e != null ) { connectionPool . connectFailed ( route , e ) ; } routeFailureCount ++ ; } } } }
Track a failure using this connection.
Track a failure using this connection .
// Retry REFUSED_STREAM errors once on the same connection. // Keep the connection for CANCEL errors. Everything else wants a fresh connection. // If this route hasn't completed a call, avoid it for new connections.