began to integrate server into main.py
This commit is contained in:
parent
26eb57a17c
commit
820465828e
@ -56,7 +56,7 @@ Copy the whole filesystem to the USB-Drive:
|
||||
|
||||
`$ 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`
|
||||
|
||||
|
24
main.py
24
main.py
@ -33,6 +33,10 @@ class Meshenger:
|
||||
a.daemon = True
|
||||
a.start()
|
||||
|
||||
s = threading.Thread(target=self.serve)
|
||||
s.daemon = True
|
||||
s.start()
|
||||
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
print 'exiting discovery thread'
|
||||
d.join()
|
||||
@ -100,19 +104,12 @@ class Meshenger:
|
||||
time.sleep(1)
|
||||
|
||||
def serve(self):
|
||||
|
||||
# try:
|
||||
# t = threading.Thread(target=BorderCheckWebserver, args=(self, ))
|
||||
# t.daemon = True
|
||||
# t.start()
|
||||
# time.sleep(2)
|
||||
# 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
|
||||
"""
|
||||
Initialize the server
|
||||
"""
|
||||
print 'Serving'
|
||||
import meshenger_serve
|
||||
meshenger_serve.main()
|
||||
|
||||
def build_index(self):
|
||||
"""
|
||||
@ -165,6 +162,7 @@ class Meshenger:
|
||||
hasj = hashlib.md5(ip).hexdigest()
|
||||
nodepath = os.path.join(os.path.abspath('nodes/'), hasj)
|
||||
if not os.path.exists(nodepath):
|
||||
os.mkdir('nodes')
|
||||
os.mkdir(nodepath)
|
||||
|
||||
return nodepath
|
||||
|
Loading…
Reference in New Issue
Block a user