| 
									
										
										
										
											2024-01-12 22:21:13 +00:00
										 |  |  | # Contains code from https://github.com/MagicStack/uvloop/tree/v0.16.0 | 
					
						
							|  |  |  | # SPDX-License-Identifier: PSF-2.0 AND (MIT OR Apache-2.0) | 
					
						
							|  |  |  | # SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc.  http://magic.io | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-27 21:22:47 +02:00
										 |  |  | import enum | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-01 14:12:50 -07:00
										 |  |  | # After the connection is lost, log warnings after this many write()s. | 
					
						
							| 
									
										
										
										
											2013-10-17 13:40:50 -07:00
										 |  |  | LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5 | 
					
						
							| 
									
										
										
										
											2013-11-01 14:12:50 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Seconds to wait before retrying accept(). | 
					
						
							|  |  |  | ACCEPT_RETRY_DELAY = 1 | 
					
						
							| 
									
										
										
										
											2017-11-07 17:23:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Number of stack entries to capture in debug mode. | 
					
						
							| 
									
										
										
										
											2017-11-07 09:05:15 -08:00
										 |  |  | # The larger the number, the slower the operation in debug mode | 
					
						
							| 
									
										
										
										
											2017-12-15 07:04:38 +02:00
										 |  |  | # (see extract_stack() in format_helpers.py). | 
					
						
							| 
									
										
										
										
											2017-11-07 17:23:29 +01:00
										 |  |  | DEBUG_STACK_DEPTH = 10 | 
					
						
							| 
									
										
										
										
											2017-12-19 19:45:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Number of seconds to wait for SSL handshake to complete | 
					
						
							| 
									
										
										
										
											2018-06-04 11:32:35 -04:00
										 |  |  | # The default timeout matches that of Nginx. | 
					
						
							|  |  |  | SSL_HANDSHAKE_TIMEOUT = 60.0 | 
					
						
							| 
									
										
										
										
											2018-01-27 21:22:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-15 18:34:00 +05:30
										 |  |  | # Number of seconds to wait for SSL shutdown to complete | 
					
						
							|  |  |  | # The default timeout mimics lingering_time | 
					
						
							|  |  |  | SSL_SHUTDOWN_TIMEOUT = 30.0 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-28 18:31:55 -04:00
										 |  |  | # 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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-15 18:34:00 +05:30
										 |  |  | FLOW_CONTROL_HIGH_WATER_SSL_READ = 256  # KiB | 
					
						
							|  |  |  | FLOW_CONTROL_HIGH_WATER_SSL_WRITE = 512  # KiB | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-28 23:09:42 +05:30
										 |  |  | # Default timeout for joining the threads in the threadpool | 
					
						
							|  |  |  | THREAD_JOIN_TIMEOUT = 300 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-27 21:22:47 +02:00
										 |  |  | # 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() |