if config.stack_size: import threading threading.stack_size(config.stack_size) # Use pure-python implementation of msgpack to save CPU if config.msgpack_purepython: os.environ["MSGPACK_PUREPYTHON"] = "True" # Socks Proxy monkey patch if config.proxy: from util import SocksProxy import urllib2 logging.info("Patching sockets to socks proxy: %s" % config.proxy) if config.fileserver_ip == "*": config.fileserver_ip = '127.0.0.1' # Do not accept connections anywhere but localhost SocksProxy.monkeyPatch(*config.proxy.split(":")) elif config.tor == "always": from util import SocksProxy import urllib2 logging.info("Patching sockets to tor socks proxy: %s" % config.tor_proxy) if config.fileserver_ip == "*": config.fileserver_ip = '127.0.0.1' # Do not accept connections anywhere but localhost SocksProxy.monkeyPatch(*config.tor_proxy.split(":")) config.disable_udp = True # -- Actions -- @PluginManager.acceptPlugins class Actions(object): def call(self, function_name, kwargs): logging.info("Version: %s r%s, Python %s, Gevent: %s" % (config.version, config.rev, sys.version, gevent.__version__))