original_string: private function connection_result($errno = null) {
          static $countfailures = array();
          $sess = sesskey();
          if (!array_key_exists($sess, $countfailures)) {
              $countfailures[$sess] = 0;
          }
          if ($errno !== null) {
              if ($errno == 0) {
                  // reset count of failed connections
                  $countfailures[$sess] = 0;
              } else if ($errno == 7 /*CURLE_COULDNT_CONNECT*/ || $errno == 9 /*CURLE_REMOTE_ACCESS_DENIED*/) {
                  // problems with server
                  $countfailures[$sess]++;
              }
          }
          return ($countfailures[$sess] < 3);
      }
code: private function connection_result($errno = null) {
          static $countfailures = array();
          $sess = sesskey();
          if (!array_key_exists($sess, $countfailures)) {
              $countfailures[$sess] = 0;
          }
          if ($errno !== null) {
              if ($errno == 0) {
                  // reset count of failed connections
                  $countfailures[$sess] = 0;
              } else if ($errno == 7 /*CURLE_COULDNT_CONNECT*/ || $errno == 9 /*CURLE_REMOTE_ACCESS_DENIED*/) {
                  // problems with server
                  $countfailures[$sess]++;
              }
          }
          return ($countfailures[$sess] < 3);
      }
code_tokens: private function connection_result ( $ errno = null ) { static $ countfailures = array ( ) ; $ sess = sesskey ( ) ; if ( ! array_key_exists ( $ sess , $ countfailures ) ) { $ countfailures [ $ sess ] = 0 ; } if ( $ errno !== null ) { if ( $ errno == 0 ) { // reset count of failed connections $ countfailures [ $ sess ] = 0 ; } else if ( $ errno == 7 /*CURLE_COULDNT_CONNECT*/ || $ errno == 9 /*CURLE_REMOTE_ACCESS_DENIED*/ ) { // problems with server $ countfailures [ $ sess ] ++ ; } } return ( $ countfailures [ $ sess ] < 3 ) ; }
docstring: Counts the number of failed connections.
  
  If we received the connection timeout more than 3 times in a row, we don't attemt to
  connect to the server any more during this request.
  
  This function is used by {@link repository_equella::sync_reference()} that
  synchronises the file size of referenced files.
  
  @param int $errno omit if we just want to know the return value, the last curl_errno otherwise
  @return bool true if we had less than 3 failed connections, false if no more connections
  attempts recommended
docstring_tokens: Counts the number of failed connections .