constants.py 888 Bytes
Newer Older
1 2
import enum

3
# After the connection is lost, log warnings after this many write()s.
4
LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5
5 6 7

# Seconds to wait before retrying accept().
ACCEPT_RETRY_DELAY = 1
8 9

# Number of stack entries to capture in debug mode.
Barry Warsaw's avatar
Barry Warsaw committed
10
# The larger the number, the slower the operation in debug mode
11
# (see extract_stack() in format_helpers.py).
12
DEBUG_STACK_DEPTH = 10
13 14

# Number of seconds to wait for SSL handshake to complete
15 16
# The default timeout matches that of Nginx.
SSL_HANDSHAKE_TIMEOUT = 60.0
17

18 19 20 21
# Used in sendfile fallback code.  We use fallback for platforms
# that don't support sendfile, or for TLS connections.
SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 256

22 23 24 25 26 27
# The enum should be here to break circular dependencies between
# base_events and sslproto
class _SendfileMode(enum.Enum):
    UNSUPPORTED = enum.auto()
    TRY_NATIVE = enum.auto()
    FALLBACK = enum.auto()