Update StemPortPlugin.py - check config.tor
This commit is contained in:
parent
92b9397ee2
commit
2e4767926c
1 changed files with 13 additions and 9 deletions
|
@ -11,11 +11,15 @@ from Plugin import PluginManager
|
||||||
from Config import config
|
from Config import config
|
||||||
from Debug import Debug
|
from Debug import Debug
|
||||||
|
|
||||||
|
if config.tor != "disable":
|
||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
monkey.patch_time()
|
monkey.patch_time()
|
||||||
monkey.patch_socket(dns=False)
|
monkey.patch_socket(dns=False)
|
||||||
monkey.patch_thread()
|
monkey.patch_thread()
|
||||||
print "Stem Port Plugin: modules are patched"
|
print "Stem Port Plugin: modules are patched."
|
||||||
|
else:
|
||||||
|
print "Stem Port Plugin: Tor mode disabled. Module patching skipped."
|
||||||
|
|
||||||
|
|
||||||
class PatchedControlPort(ControlPort):
|
class PatchedControlPort(ControlPort):
|
||||||
def _make_socket(self):
|
def _make_socket(self):
|
||||||
|
@ -97,7 +101,7 @@ class TorManagerPlugin(object):
|
||||||
if service.private_key_type != "RSA1024":
|
if service.private_key_type != "RSA1024":
|
||||||
raise Exception("ZeroNet doesn't support crypto " + service.private_key_type)
|
raise Exception("ZeroNet doesn't support crypto " + service.private_key_type)
|
||||||
|
|
||||||
self.log.info("Stem created %s.onion (async descriptor publication)" % service.service_id)
|
self.log.debug("Stem created %s.onion (async descriptor publication)" % service.service_id)
|
||||||
|
|
||||||
return (service.service_id, service.private_key)
|
return (service.service_id, service.private_key)
|
||||||
|
|
||||||
|
@ -123,16 +127,16 @@ class TorManagerPlugin(object):
|
||||||
if not self.enabled:
|
if not self.enabled:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self.log.debug("[WARNING] StemPort self.request should not be called")
|
self.log.error("[WARNING] StemPort self.request should not be called")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def send(self, cmd, conn=None):
|
def send(self, cmd, conn=None):
|
||||||
self.log.debug("[WARNING] StemPort self.send should not be called")
|
self.log.error("[WARNING] StemPort self.send should not be called")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def createSocket(self, onion, port):
|
def createSocket(self, onion, port):
|
||||||
if not self.enabled:
|
if not self.enabled:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.debug.log("[WARNING] StemPort createSocket should not be called")
|
self.log.error("[WARNING] StemPort createSocket should not be called")
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in a new issue