This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Multiple close() for asyncore.dispatcher.
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: klimkin, rhettinger
Priority: normal Keywords:

Created on 2004-02-07 18:03 by klimkin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg19936 - (view) Author: Alexey Klimkin (klimkin) Date: 2004-02-07 18:03
dispatcher uses self._fileno to store socket's fd. 

    def del_channel(self, map=None):
        fd = self._fileno
        if map is None:
            map = socket_map
        if map.has_key(fd):
            #self.log_info('closing channel %d:%s' %
(fd, self))
            del map[fd]

calling close() for already closed channel will remove
new channels with same fileno.

The simple fix works perfect:

    def del_channel(self, map=None):
        if self._fileno is not None:
            fd = self._fileno
            if map is None:
                map = socket_map
            if map.has_key(fd):
                #self.log_info('closing channel %d:%s'
% (fd, self))
                del map[fd]
            self._fileno = None
msg19937 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-02-08 11:36
Logged In: YES 
user_id=80475

Accepted and applied:  Lib/asyncore.py  1.44
Thanks for the contribution.


History
Date User Action Args
2022-04-11 14:56:02adminsetgithub: 39909
2004-02-07 18:03:26klimkincreate