On Tue, Jul 01, 2003 at 04:44:49PM +0400, Oleg Broytmann wrote: > How could I say to user "good by" and stop my program? I want to do > something like that: > > def quit(request): > publisher.session_mgr.expire_session(request) > signal_asyncore_to_process_the_last_request_and_stop() > return "Thank you! Goodby!" I solved the problem the following way: import asyncore GlobalOptions.quit_flag = 0 def quit(request): GlobalOptions.quit_flag = 1 request.response.set_header("Connection", "close") GlobalOptions.publisher.session_mgr.expire_session(request) return "Thank you! Goodby!" from medusa import http_server class QuitMonitoringChannel(http_server.http_channel): def close(self): http_server.http_channel.close(self) if GlobalOptions.quit_flag: asyncore.close_all() def main(): server = http_server.http_server(host, port) server.channel_class = QuitMonitoringChannel Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.