0
  A   ˆl–Ðz¾”d
eJe@
à�q¦ÔÅ£�þ^#ë7+.†BWßhÏÉƒšÈ_ŠI|¥�+Wé3ž¯ÇÆ É    # Copyright (C) 2006-2014 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""Status message handling"""
import time
from . import task


class Status(task.LoggedCheckedTask):
    """Thread that gathers and logs the status periodically."""

    def __init__(self, aggregator, wait_seconds):
        """Initialize the status logger task.

        @param urlqueue: the URL queue
        @type urlqueue: Urlqueue
        @param logger: the logger object to inform about status
        @type logger: console.StatusLogger
        @param wait_seconds: interval in seconds to report status
        @type wait_seconds: int
        """
        logger = aggregator.config.status_logger
        super().__init__(logger)
        self.aggregator = aggregator
        self.wait_seconds = wait_seconds
        assert self.wait_seconds >= 1

    def run_checked(self):
        """Print periodic status messages."""
        self.start_time = time.time()
        self.name = "Status"
        # the first status should be after a second
        wait_seconds = 1
        first_wait = True
        while not self.stopped(wait_seconds):
            self.log_status()
            if first_wait:
                wait_seconds = self.wait_seconds
                first_wait = False

    def log_status(self):
        """Log a status message."""
        duration = time.time() - self.start_time
        checked, in_progress, queue = self.aggregator.urlqueue.status()
        num_urls = len(self.aggregator.result_cache)
        self.logger.log_status(checked, in_progress, queue, duration, num_urls)
  C   ˆl–Ãa¾”êh¥2 ¸&®6â˜´o�þ]e¡¬Ü¤’¸Æ ùË„í…¯Ê_‹I|¥�+ýÿ¹ä³ÉÈ ?÷     //
// write_at.hpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef BOOST_ASIO_WRITE_AT_HPP
#define BOOST_ASIO_WRITE_AT_HPP

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include <boost/asio/detail/config.hpp>
#include <cstddef>
#include <boost/asio/async_result.hpp>
#include <boost/asio/detail/cstdint.hpp>
#include <boost/asio/error.hpp>

#if !defined(BOOST_ASIO_NO_EXTENSIONS)
# include <boost/asio/basic_streambuf_fwd.hpp>
#endif // !defined(BOOST_ASIO_NO_EXTENSIONS)

#include <boost/asio/detail/push_options.hpp>

namespace boost {
namespace asio {

/**
 * @defgroup write_at boost::asio::write_at
 *
 * @brief The @c write_at function is a composed operation that writes a
 * certain amount of data at a specified offset before returning.
 */
/*@{*/

/// Write all of the supplied data at the specified offset before returning.
/**
 * This function is used to write a certain number of bytes of data to a random
 * access device at a specified offset. The call will block until one of the
 * following conditions is true:
 *
 * @li All of the data in the supplied buffers has been written. That is, the
 * bytes transferred is equal to the sum of the buffer sizes.
 *
 * @li An error occurred.
 *
 * This operation is implemented in terms of zero or more calls to the device's
 * write_some_at function.
 *
 * @param d The device to which the data is to be written. The type must support
