Fix for importing libs before monkey patching breaks tor support

This commit is contained in:
HelloZeroNet 2015-06-18 02:53:01 +02:00
parent c565a12fc3
commit f58aa5f78e
2 changed files with 5 additions and 10 deletions

View file

@ -3,15 +3,12 @@
import os import os
import sys import sys
import time import time
import urllib2 import logging
# Third party modules # Third party modules
import gevent import gevent
from gevent import monkey from gevent import monkey
# ZeroNet modules
import logging
update_after_shutdown = False # If set True then update and restart zeronet after main loop ended update_after_shutdown = False # If set True then update and restart zeronet after main loop ended
@ -68,7 +65,7 @@ logging.debug("Config: %s" % config)
# Socks Proxy monkey patch # Socks Proxy monkey patch
if config.proxy: if config.proxy:
from util import SocksProxy from util import SocksProxy
import urllib2
logging.info("Patching sockets to socks proxy: %s" % config.proxy) logging.info("Patching sockets to socks proxy: %s" % config.proxy)
config.fileserver_ip = '127.0.0.1' # Do not accept connections anywhere but localhost config.fileserver_ip = '127.0.0.1' # Do not accept connections anywhere but localhost
SocksProxy.monkeyPath(*config.proxy.split(":")) SocksProxy.monkeyPath(*config.proxy.split(":"))

View file

@ -2,12 +2,7 @@
# Included modules # Included modules
import os import os
import gc
import sys import sys
import traceback
# ZeroNet Modules
import update
def main(): def main():
@ -19,6 +14,8 @@ def main():
import main import main
main.start() main.start()
if main.update_after_shutdown: # Updater if main.update_after_shutdown: # Updater
import gc
import update
# Try cleanup openssl # Try cleanup openssl
try: try:
if "lib.opensslVerify" in sys.modules: if "lib.opensslVerify" in sys.modules:
@ -38,6 +35,7 @@ def main():
logger.removeHandler(handler) logger.removeHandler(handler)
except (Exception, ): # Prevent closing except (Exception, ): # Prevent closing
import traceback
traceback.print_exc() traceback.print_exc()
traceback.print_exc(file=open("log/error.log", "a")) traceback.print_exc(file=open("log/error.log", "a"))