codekingpro/portable-devtools
114k
1# Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.02# SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0)3# SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io4 5import enum6 7# After the connection is lost, log warnings after this many write()s.8LOG_THRESHOLD_FOR_CONNLOST_WRITES = 59 10# Seconds to wait before retrying accept().11ACCEPT_RETRY_DELAY = 112 13# Number of stack entries to capture in debug mode.14# The larger the number, the slower the operation in debug mode15# (see extract_stack() in format_helpers.py).16DEBUG_STACK_DEPTH = 1017 18# Number of seconds to wait for SSL handshake to complete19# The default timeout matches that of Nginx.20SSL_HANDSHAKE_TIMEOUT = 60.021 22# Number of seconds to wait for SSL shutdown to complete23# The default timeout mimics lingering_time24SSL_SHUTDOWN_TIMEOUT = 30.025 26# Used in sendfile fallback code. We use fallback for platforms27# that don't support sendfile, or for TLS connections.28SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 25629 30FLOW_CONTROL_HIGH_WATER_SSL_READ = 256 # KiB31FLOW_CONTROL_HIGH_WATER_SSL_WRITE = 512 # KiB32 33# Default timeout for joining the threads in the threadpool34THREAD_JOIN_TIMEOUT = 30035 36# The enum should be here to break circular dependencies between37# base_events and sslproto38class _SendfileMode(enum.Enum):39 UNSUPPORTED = enum.auto()40 TRY_NATIVE = enum.auto()41 FALLBACK = enum.auto()42 