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);
    }
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);
    }
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 ) ; }
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
Counts the number of failed connections .