'If the last MAX_ERROR_COUNT - 1 responses are errors then we check if
the remote server root path is still reachable. If it is, we add
(True, SUCCESS) to the last responses and continue; else we return False
because we\'re in a case where:
* The user\'s connection is dead
* The remote server is unreachable
:return: True if we should stop the scan due to too many consecutive
errors being received from the server.
:see: https://github.com/andresriancho/w3af/issues/8698'

def _should_stop_scan(self, request):

    last_n_responses = list(self._last_responses)[(- MAX_ERROR_COUNT):]
    first_result = last_n_responses[0]
    last_n_without_first = last_n_responses[1:]
    if (len(last_n_without_first) != (MAX_ERROR_COUNT - 1)):
        return False
    all_following_failed = True
    for response_meta in last_n_without_first:
        if response_meta.successful:
            all_following_failed = False
            break
    if (first_result.successful and all_following_failed):
        if self._server_root_path_is_reachable(request):
            return False
        return True
    return False
