|
@ -33,6 +33,10 @@ class Meshenger: |
|
|
a.daemon = True |
|
|
a.daemon = True |
|
|
a.start() |
|
|
a.start() |
|
|
|
|
|
|
|
|
|
|
|
s = threading.Thread(target=self.serve) |
|
|
|
|
|
s.daemon = True |
|
|
|
|
|
s.start() |
|
|
|
|
|
|
|
|
except (KeyboardInterrupt, SystemExit): |
|
|
except (KeyboardInterrupt, SystemExit): |
|
|
print 'exiting discovery thread' |
|
|
print 'exiting discovery thread' |
|
|
d.join() |
|
|
d.join() |
|
@ -100,19 +104,12 @@ class Meshenger: |
|
|
time.sleep(1) |
|
|
time.sleep(1) |
|
|
|
|
|
|
|
|
def serve(self): |
|
|
def serve(self): |
|
|
|
|
|
""" |
|
|
# try: |
|
|
Initialize the server |
|
|
# t = threading.Thread(target=BorderCheckWebserver, args=(self, )) |
|
|
""" |
|
|
# t.daemon = True |
|
|
print 'Serving' |
|
|
# t.start() |
|
|
import meshenger_serve |
|
|
# time.sleep(2) |
|
|
meshenger_serve.main() |
|
|
# except (KeyboardInterrupt, SystemExit): |
|
|
|
|
|
# t.join() |
|
|
|
|
|
# sys.exit() |
|
|
|
|
|
|
|
|
|
|
|
a = '' |
|
|
|
|
|
# serves both the index and the messages on the node over http |
|
|
|
|
|
# plus manages the client-side web interface |
|
|
|
|
|
|
|
|
|
|
|
def build_index(self): |
|
|
def build_index(self): |
|
|
""" |
|
|
""" |
|
@ -165,6 +162,7 @@ class Meshenger: |
|
|
hasj = hashlib.md5(ip).hexdigest() |
|
|
hasj = hashlib.md5(ip).hexdigest() |
|
|
nodepath = os.path.join(os.path.abspath('nodes/'), hasj) |
|
|
nodepath = os.path.join(os.path.abspath('nodes/'), hasj) |
|
|
if not os.path.exists(nodepath): |
|
|
if not os.path.exists(nodepath): |
|
|
|
|
|
os.mkdir('nodes') |
|
|
os.mkdir(nodepath) |
|
|
os.mkdir(nodepath) |
|
|
|
|
|
|
|
|
return nodepath |
|
|
return nodepath |
|
|