added exception to main if foreing index cant be downloaded
This commit is contained in:
parent
0a3148d063
commit
fb023f8a8b
@ -28,7 +28,7 @@ git clone git://github.com/jngrt/meshenger.git
|
|||||||
|
|
||||||
mv uhttpd /etc/config/uhttpd
|
mv uhttpd /etc/config/uhttpd
|
||||||
|
|
||||||
echo 'my ip address is:'
|
echo 'my ip address is:' #klopt nog niet
|
||||||
ifconfig br-lan | grep 'inet addr'
|
ifconfig br-lan | grep 'inet addr'
|
||||||
|
|
||||||
echo 'Done configuring you can now reboot using $reboot -f'
|
echo 'Done configuring you can now reboot using $reboot -f'
|
||||||
|
23
main.py
23
main.py
@ -14,7 +14,7 @@ class Meshenger:
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
#os.system("echo 1 >> /proc/sys/net/ipv6/conf/br-lan/disable_ipv6")
|
os.system("echo 1 >> /proc/sys/net/ipv6/conf/br-lan/disable_ipv6")
|
||||||
self.own_ip = self.get_ip_adress()
|
self.own_ip = self.get_ip_adress()
|
||||||
|
|
||||||
if not os.path.exists(self.msg_dir):
|
if not os.path.exists(self.msg_dir):
|
||||||
@ -144,15 +144,16 @@ class Meshenger:
|
|||||||
"""
|
"""
|
||||||
Get new messages from other node based on it's index file
|
Get new messages from other node based on it's index file
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
with open(os.path.join(path,'index')) as index:
|
with open(os.path.join(path,'index')) as index:
|
||||||
index = index.read().split('\n')
|
index = index.read().split('\n')
|
||||||
for message in index:
|
for message in index:
|
||||||
messagepath = os.path.join(os.path.abspath(self.msg_dir), message)
|
messagepath = os.path.join(os.path.abspath(self.msg_dir), message)
|
||||||
if not os.path.exists(messagepath):
|
if not os.path.exists(messagepath):
|
||||||
print 'downloading', message, 'to', messagepath
|
print 'downloading', message, 'to', messagepath
|
||||||
os.system('wget http://['+ip+'%adhoc0]:13338/msg/'+message+' -O '+messagepath)
|
os.system('wget http://['+ip+'%adhoc0]:13338/msg/'+message+' -O '+messagepath)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def ip_to_hash(self, ip):
|
def ip_to_hash(self, ip):
|
||||||
"""
|
"""
|
||||||
@ -178,7 +179,7 @@ class Meshenger:
|
|||||||
Hack to adhoc0's inet6 adress
|
Hack to adhoc0's inet6 adress
|
||||||
"""
|
"""
|
||||||
if not os.path.isfile('interfaceip6adress'):
|
if not os.path.isfile('interfaceip6adress'):
|
||||||
os.system('ifconfig -a adhoc0 | grep inet6 > interfaceip6adress')
|
os.system('ifconfig -a adhoc0 | grep inet6 > /root/meshenger/interfaceip6adress')
|
||||||
with open('interfaceip6adress', 'r') as a:
|
with open('interfaceip6adress', 'r') as a:
|
||||||
return a.read().split()[2].split('/')[0]
|
return a.read().split()[2].split('/')[0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user