Andrew Svetlov | 7c68407 | 2018-01-27 21:22:47 +0200 | [diff] [blame] | 1 | import enum |
| 2 | |
Guido van Rossum | 3317a13 | 2013-11-01 14:12:50 -0700 | [diff] [blame] | 3 | # After the connection is lost, log warnings after this many write()s. |
Guido van Rossum | 27b7c7e | 2013-10-17 13:40:50 -0700 | [diff] [blame] | 4 | LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5 |
Guido van Rossum | 3317a13 | 2013-11-01 14:12:50 -0700 | [diff] [blame] | 5 | |
| 6 | # Seconds to wait before retrying accept(). |
| 7 | ACCEPT_RETRY_DELAY = 1 |
Antoine Pitrou | 921e943 | 2017-11-07 17:23:29 +0100 | [diff] [blame] | 8 | |
| 9 | # Number of stack entries to capture in debug mode. |
Barry Warsaw | c060c7e | 2017-11-07 09:05:15 -0800 | [diff] [blame] | 10 | # The larger the number, the slower the operation in debug mode |
Andrew Svetlov | f74ef45 | 2017-12-15 07:04:38 +0200 | [diff] [blame] | 11 | # (see extract_stack() in format_helpers.py). |
Antoine Pitrou | 921e943 | 2017-11-07 17:23:29 +0100 | [diff] [blame] | 12 | DEBUG_STACK_DEPTH = 10 |
Neil Aspinall | f7686c1 | 2017-12-19 19:45:42 +0000 | [diff] [blame] | 13 | |
| 14 | # Number of seconds to wait for SSL handshake to complete |
Yury Selivanov | 9602643 | 2018-06-04 11:32:35 -0400 | [diff] [blame] | 15 | # The default timeout matches that of Nginx. |
| 16 | SSL_HANDSHAKE_TIMEOUT = 60.0 |
Andrew Svetlov | 7c68407 | 2018-01-27 21:22:47 +0200 | [diff] [blame] | 17 | |
Yury Selivanov | 7165754 | 2018-05-28 18:31:55 -0400 | [diff] [blame] | 18 | # Used in sendfile fallback code. We use fallback for platforms |
| 19 | # that don't support sendfile, or for TLS connections. |
| 20 | SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 256 |
| 21 | |
Andrew Svetlov | 7c68407 | 2018-01-27 21:22:47 +0200 | [diff] [blame] | 22 | # The enum should be here to break circular dependencies between |
| 23 | # base_events and sslproto |
| 24 | class _SendfileMode(enum.Enum): |
| 25 | UNSUPPORTED = enum.auto() |
| 26 | TRY_NATIVE = enum.auto() |
| 27 | FALLBACK = enum.auto() |