mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
asyncore: introduce a new 'closed' attribute to make sure that dispatcher gets closed only once.
In different occasions close() might be called more than once, causing problems with already disconnected sockets/dispatchers.
This commit is contained in:
parent
2933312fe7
commit
42e0b7f47e
1 changed files with 11 additions and 9 deletions
|
@ -220,7 +220,7 @@ class dispatcher:
|
|||
|
||||
connected = False
|
||||
accepting = False
|
||||
closing = False
|
||||
closed = False
|
||||
addr = None
|
||||
ignore_log_types = frozenset(['warning'])
|
||||
|
||||
|
@ -393,6 +393,8 @@ class dispatcher:
|
|||
raise
|
||||
|
||||
def close(self):
|
||||
if not self.closed:
|
||||
self.closed = True
|
||||
self.connected = False
|
||||
self.accepting = False
|
||||
self.del_channel()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue