constants.py 888 B

123456789101112131415161718192021222324252627
  1. import enum
  2. # After the connection is lost, log warnings after this many write()s.
  3. LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5
  4. # Seconds to wait before retrying accept().
  5. ACCEPT_RETRY_DELAY = 1
  6. # Number of stack entries to capture in debug mode.
  7. # The larger the number, the slower the operation in debug mode
  8. # (see extract_stack() in format_helpers.py).
  9. DEBUG_STACK_DEPTH = 10
  10. # Number of seconds to wait for SSL handshake to complete
  11. # The default timeout matches that of Nginx.
  12. SSL_HANDSHAKE_TIMEOUT = 60.0
  13. # Used in sendfile fallback code. We use fallback for platforms
  14. # that don't support sendfile, or for TLS connections.
  15. SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 256
  16. # The enum should be here to break circular dependencies between
  17. # base_events and sslproto
  18. class _SendfileMode(enum.Enum):
  19. UNSUPPORTED = enum.auto()
  20. TRY_NATIVE = enum.auto()
  21. FALLBACK = enum.auto()