Version 0.2.3, One click updater from github, Clean FileServer and UiServer shutdown, Count UiServer http connections to clean close, serverUpdate WrapperAPI command, randomize peers before work start and publish, switched to upnpc-shared it has better virustotal reputation
This commit is contained in:
parent
68e3ee158c
commit
531bf68ddd
12 changed files with 157 additions and 36 deletions
40
zeronet.py
40
zeronet.py
|
@ -1,13 +1,37 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def main():
|
||||
try:
|
||||
from src import main
|
||||
main.start()
|
||||
except Exception, err: # Prevent closing
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
raw_input("-- Error happened, press enter to close --")
|
||||
try:
|
||||
from src import main
|
||||
main.start()
|
||||
if main.update_after_shutdown: # Updater
|
||||
import update, sys, os, gc
|
||||
# Update
|
||||
update.update()
|
||||
|
||||
# Close log files
|
||||
logger = sys.modules["src.main"].logging.getLogger()
|
||||
|
||||
for handler in logger.handlers[:]:
|
||||
handler.flush()
|
||||
handler.close()
|
||||
logger.removeHandler(handler)
|
||||
|
||||
except Exception, err: # Prevent closing
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
raw_input("-- Error happened, press enter to close --")
|
||||
|
||||
if main.update_after_shutdown: # Updater
|
||||
# Restart
|
||||
gc.collect() # Garbage collect
|
||||
print "Restarting..."
|
||||
args = sys.argv[:]
|
||||
args.insert(0, sys.executable)
|
||||
if sys.platform == 'win32':
|
||||
args = ['"%s"' % arg for arg in args]
|
||||
os.execv(sys.executable, args)
|
||||
print "Bye."
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue