Coverage for Lib/asyncio/constants.py: 100%
16 statements
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-20 05:46 +0000
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-20 05:46 +0000
1# Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0
2# SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0)
3# SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io
5import enum
6import time
8# After the connection is lost, log warnings after this many write()s.
9LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5
11# Seconds to wait before retrying accept().
12ACCEPT_RETRY_DELAY = 1
14# Number of stack entries to capture in debug mode.
15# The larger the number, the slower the operation in debug mode
16# (see extract_stack() in format_helpers.py).
17DEBUG_STACK_DEPTH = 10
19# Number of seconds to wait for SSL handshake to complete
20# The default timeout matches that of Nginx.
21SSL_HANDSHAKE_TIMEOUT = 60.0
23# Number of seconds to wait for SSL shutdown to complete
24# The default timeout mimics lingering_time
25SSL_SHUTDOWN_TIMEOUT = 30.0
27# Used in sendfile fallback code. We use fallback for platforms
28# that don't support sendfile, or for TLS connections.
29SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 256
31FLOW_CONTROL_HIGH_WATER_SSL_READ = 256 # KiB
32FLOW_CONTROL_HIGH_WATER_SSL_WRITE = 512 # KiB
34# Default timeout for joining the threads in the threadpool
35THREAD_JOIN_TIMEOUT = 300
37# Resolution of the clock used by the event loop, in seconds.
38CLOCK_RESOLUTION = time.get_clock_info('monotonic').resolution
40# The enum should be here to break circular dependencies between
41# base_events and sslproto
42class _SendfileMode(enum.Enum):
43 UNSUPPORTED = enum.auto()
44 TRY_NATIVE = enum.auto()
45 FALLBACK = enum.auto()