blob: 33feed60e55b008104ec01f0ce6cbb9d573a8eb3 [file] [log] [blame]
Andrew Svetlov7c684072018-01-27 21:22:47 +02001import enum
2
Guido van Rossum3317a132013-11-01 14:12:50 -07003# After the connection is lost, log warnings after this many write()s.
Guido van Rossum27b7c7e2013-10-17 13:40:50 -07004LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5
Guido van Rossum3317a132013-11-01 14:12:50 -07005
6# Seconds to wait before retrying accept().
7ACCEPT_RETRY_DELAY = 1
Antoine Pitrou921e9432017-11-07 17:23:29 +01008
9# Number of stack entries to capture in debug mode.
Barry Warsawc060c7e2017-11-07 09:05:15 -080010# The larger the number, the slower the operation in debug mode
Andrew Svetlovf74ef452017-12-15 07:04:38 +020011# (see extract_stack() in format_helpers.py).
Antoine Pitrou921e9432017-11-07 17:23:29 +010012DEBUG_STACK_DEPTH = 10
Neil Aspinallf7686c12017-12-19 19:45:42 +000013
14# Number of seconds to wait for SSL handshake to complete
Yury Selivanov96026432018-06-04 11:32:35 -040015# The default timeout matches that of Nginx.
16SSL_HANDSHAKE_TIMEOUT = 60.0
Andrew Svetlov7c684072018-01-27 21:22:47 +020017
Yury Selivanov71657542018-05-28 18:31:55 -040018# Used in sendfile fallback code. We use fallback for platforms
19# that don't support sendfile, or for TLS connections.
20SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 256
21
Andrew Svetlov7c684072018-01-27 21:22:47 +020022# The enum should be here to break circular dependencies between
23# base_events and sslproto
24class _SendfileMode(enum.Enum):
25 UNSUPPORTED = enum.auto()
26 TRY_NATIVE = enum.auto()
27 FALLBACK = enum.auto()