Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Side by Side Diff: Lib/asyncio/base_events.py

Issue 27906: Socket accept exhaustion during high TCP traffic
Patch Set: Created 3 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/asyncio/selector_events.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Base implementation of event loop. 1 """Base implementation of event loop.
2 2
3 The event loop can be broken up into a multiplexer (the part 3 The event loop can be broken up into a multiplexer (the part
4 responsible for notifying us of I/O events) and the event loop proper, 4 responsible for notifying us of I/O events) and the event loop proper,
5 which wraps a multiplexer with functionality for scheduling callbacks, 5 which wraps a multiplexer with functionality for scheduling callbacks,
6 immediately or at a given time in the future. 6 immediately or at a given time in the future.
7 7
8 Whenever a public API takes a callback, subsequent positional 8 Whenever a public API takes a callback, subsequent positional
9 arguments will be passed to the callback if/when it is called. This 9 arguments will be passed to the callback if/when it is called. This
10 avoids the proliferation of trivial lambdas implementing closures. 10 avoids the proliferation of trivial lambdas implementing closures.
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 sock.close() 969 sock.close()
970 else: 970 else:
971 if sock is None: 971 if sock is None:
972 raise ValueError('Neither host/port nor sock were specified') 972 raise ValueError('Neither host/port nor sock were specified')
973 sockets = [sock] 973 sockets = [sock]
974 974
975 server = Server(self, sockets) 975 server = Server(self, sockets)
976 for sock in sockets: 976 for sock in sockets:
977 sock.listen(backlog) 977 sock.listen(backlog)
978 sock.setblocking(False) 978 sock.setblocking(False)
979 self._start_serving(protocol_factory, sock, ssl, server) 979 self._start_serving(protocol_factory, sock, ssl, server, backlog)
980 if self._debug: 980 if self._debug:
981 logger.info("%r is serving", server) 981 logger.info("%r is serving", server)
982 return server 982 return server
983 983
984 @coroutine 984 @coroutine
985 def connect_accepted_socket(self, protocol_factory, sock, *, ssl=None): 985 def connect_accepted_socket(self, protocol_factory, sock, *, ssl=None):
986 """Handle an accepted connection. 986 """Handle an accepted connection.
987 987
988 This is used by servers that accept connections outside of 988 This is used by servers that accept connections outside of
989 asyncio but that use asyncio to handle connections. 989 asyncio but that use asyncio to handle connections.
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 self._coroutine_wrapper_set = False 1367 self._coroutine_wrapper_set = False
1368 1368
1369 def get_debug(self): 1369 def get_debug(self):
1370 return self._debug 1370 return self._debug
1371 1371
1372 def set_debug(self, enabled): 1372 def set_debug(self, enabled):
1373 self._debug = enabled 1373 self._debug = enabled
1374 1374
1375 if self.is_running(): 1375 if self.is_running():
1376 self._set_coroutine_wrapper(enabled) 1376 self._set_coroutine_wrapper(enabled)
OLDNEW
« no previous file with comments | « no previous file | Lib/asyncio/selector_events.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+