Browse Source

began to integrate server into main.py

develop
Roel 11 years ago
parent
commit
820465828e
  1. 2
      README.md
  2. 24
      main.py

2
README.md

@ -56,7 +56,7 @@ Copy the whole filesystem to the USB-Drive:
`$ mount --bind / /tmp/cproot` `$ mount --bind / /tmp/cproot`
`$ tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf` `$ tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf -`
`$ umount /tmp/cproot` `$ umount /tmp/cproot`

24
main.py

@ -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

Loading…
Cancel
Save