|
@@ -1145,24 +1145,27 @@ class ServerOptions(Options):
|
|
|
pass
|
|
|
|
|
|
def close_httpservers(self):
|
|
|
+ dispatcher_servers = []
|
|
|
for config, server in self.httpservers:
|
|
|
server.close()
|
|
|
- map = self.get_socket_map()
|
|
|
# server._map is a reference to the asyncore socket_map
|
|
|
- for dispatcher in map.values():
|
|
|
- # For unknown reasons, sometimes an http_channel
|
|
|
- # dispatcher in the socket map related to servers
|
|
|
- # remains open *during a reload*. If one of these
|
|
|
- # exists at this point, we need to close it by hand
|
|
|
- # (thus removing it from the asyncore.socket_map). If
|
|
|
- # we don't do this, 'cleanup_fds' will cause its file
|
|
|
- # descriptor to be closed, but it will still remain in
|
|
|
- # the socket_map, and eventually its file descriptor
|
|
|
- # will be passed to # select(), which will bomb. See
|
|
|
- # also http://www.plope.com/software/collector/253
|
|
|
+ for dispatcher in self.get_socket_map().values():
|
|
|
dispatcher_server = getattr(dispatcher, 'server', None)
|
|
|
if dispatcher_server is server:
|
|
|
- dispatcher.close()
|
|
|
+ dispatcher_servers.append(dispatcher)
|
|
|
+ for server in dispatcher_servers:
|
|
|
+ # TODO: try to remove this entirely.
|
|
|
+ # For unknown reasons, sometimes an http_channel
|
|
|
+ # dispatcher in the socket map related to servers
|
|
|
+ # remains open *during a reload*. If one of these
|
|
|
+ # exists at this point, we need to close it by hand
|
|
|
+ # (thus removing it from the asyncore.socket_map). If
|
|
|
+ # we don't do this, 'cleanup_fds' will cause its file
|
|
|
+ # descriptor to be closed, but it will still remain in
|
|
|
+ # the socket_map, and eventually its file descriptor
|
|
|
+ # will be passed to # select(), which will bomb. See
|
|
|
+ # also http://www.plope.com/software/collector/253
|
|
|
+ server.close()
|
|
|
|
|
|
def close_logger(self):
|
|
|
self.logger.close()
|