constants.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. # Number of seconds to wait for SSL shutdown to complete
  14. # The default timeout mimics lingering_time
  15. SSL_SHUTDOWN_TIMEOUT = 30.0
  16. # Used in sendfile fallback code. We use fallback for platforms
  17. # that don't support sendfile, or for TLS connections.
  18. SENDFILE_FALLBACK_READBUFFER_SIZE = 1024 * 256
  19. FLOW_CONTROL_HIGH_WATER_SSL_READ = 256 # KiB
  20. FLOW_CONTROL_HIGH_WATER_SSL_WRITE = 512 # KiB
  21. # Default timeout for joining the threads in the threadpool
  22. THREAD_JOIN_TIMEOUT = 300
  23. # The enum should be here to break circular dependencies between
  24. # base_events and sslproto
  25. class _SendfileMode(enum.Enum):
  26. UNSUPPORTED = enum.auto()
  27. TRY_NATIVE = enum.auto()
  28. FALLBACK = enum.auto()