# need to use '' or some other IP instead of '127.0.0.1'. ms = monitor.secure_monitor_server ('fnord', '127.0.0.1', MONITOR_PORT) # =========================================================================== # Chat Server # =========================================================================== # The chat server is a simple IRC-like server: It is meant as a # demonstration of how to write new servers and plug them into medusa. # It's a very simple server (it took about 2 hours to write), but it # could be easily extended. For example, it could be integrated with # the web server, perhaps providing navigational tools to browse # through a series of discussion groups, listing the number of current # users, authentication, etc... cs = chat_server.chat_server (IP_ADDRESS, CHAT_PORT) # =========================================================================== # Status Handler # =========================================================================== # These are objects that can report their status via the HTTP server. # You may comment out any of these, or add more of your own. The only # requirement for a 'status-reporting' object is that it have a method # 'status' that will return a producer, which will generate an HTML # description of the status of the object. status_objects = [ hs, ftp, ms,
import supervisor.medusa.monitor as monitor import supervisor.medusa.filesys as filesys import supervisor.medusa.default_handler as default_handler import supervisor.medusa.ftp_server as ftp_server import supervisor.medusa.chat_server as chat_server import supervisor.medusa.resolver as resolver rs = resolver.caching_resolver('127.0.0.1') lg = logger.file_logger(sys.stdout) ms = monitor.secure_monitor_server('fnord', '127.0.0.1', 9999) fs = filesys.os_filesystem(sys.argv[1]) dh = default_handler.default_handler(fs) hs = http_server('', int(sys.argv[2]), rs, lg) hs.install_handler(dh) ftp = ftp_server.ftp_server(ftp_server.dummy_authorizer(sys.argv[1]), port=8021, resolver=rs, logger_object=lg) cs = chat_server.chat_server('', 7777) if '-p' in sys.argv: def profile_loop(): try: asyncore.loop() except KeyboardInterrupt: pass import profile profile.run('profile_loop()', 'profile.out') else: asyncore.loop()
import supervisor.medusa.ftp_server as ftp_server import supervisor.medusa.chat_server as chat_server import supervisor.medusa.resolver as resolver import supervisor.medusa.logger as logger rs = resolver.caching_resolver ('127.0.0.1') lg = logger.file_logger (sys.stdout) ms = monitor.secure_monitor_server ('fnord', '127.0.0.1', 9999) fs = filesys.os_filesystem (sys.argv[1]) dh = default_handler.default_handler (fs) hs = http_server ('', int(sys.argv[2]), rs, lg) hs.install_handler (dh) ftp = ftp_server.ftp_server ( ftp_server.dummy_authorizer(sys.argv[1]), port=8021, resolver=rs, logger_object=lg ) cs = chat_server.chat_server ('', 7777) sh = status_handler.status_extension([hs,ms,ftp,cs,rs]) hs.install_handler (sh) if '-p' in sys.argv: def profile_loop (): try: asyncore.loop() except KeyboardInterrupt: pass import profile profile.run ('profile_loop()', 'profile.out') else: asyncore.loop()
# need to use '' or some other IP instead of '127.0.0.1'. ms = monitor.secure_monitor_server('fnord', '127.0.0.1', MONITOR_PORT) # =========================================================================== # Chat Server # =========================================================================== # The chat server is a simple IRC-like server: It is meant as a # demonstration of how to write new servers and plug them into medusa. # It's a very simple server (it took about 2 hours to write), but it # could be easily extended. For example, it could be integrated with # the web server, perhaps providing navigational tools to browse # through a series of discussion groups, listing the number of current # users, authentication, etc... cs = chat_server.chat_server(IP_ADDRESS, CHAT_PORT) # =========================================================================== # Status Handler # =========================================================================== # These are objects that can report their status via the HTTP server. # You may comment out any of these, or add more of your own. The only # requirement for a 'status-reporting' object is that it have a method # 'status' that will return a producer, which will generate an HTML # description of the status of the object. status_objects = [hs, ftp, ms, cs, rs, lg] # Create a status handler. By default it binds to the URI '/status'... sh = status_handler.status_extension(status_objects)
else: import supervisor.medusa.monitor as monitor import supervisor.medusa.filesys as filesys import supervisor.medusa.default_handler as default_handler import supervisor.medusa.ftp_server as ftp_server import supervisor.medusa.chat_server as chat_server import supervisor.medusa.resolver as resolver rs = resolver.caching_resolver("127.0.0.1") lg = logger.file_logger(sys.stdout) ms = monitor.secure_monitor_server("fnord", "127.0.0.1", 9999) fs = filesys.os_filesystem(sys.argv[1]) dh = default_handler.default_handler(fs) hs = http_server("", int(sys.argv[2]), rs, lg) hs.install_handler(dh) ftp = ftp_server.ftp_server(ftp_server.dummy_authorizer(sys.argv[1]), port=8021, resolver=rs, logger_object=lg) cs = chat_server.chat_server("", 7777) if "-p" in sys.argv: def profile_loop(): try: asyncore.loop() except KeyboardInterrupt: pass import profile profile.run("profile_loop()", "profile.out") else: asyncore.loop()