2020-07-26 02:36:48 +00:00
|
|
|
"""Onionr - Private P2P Communication.
|
2019-07-01 20:38:55 +00:00
|
|
|
|
2020-07-26 02:36:48 +00:00
|
|
|
Shutdown the node either hard or cleanly
|
2020-01-07 00:25:51 +00:00
|
|
|
"""
|
|
|
|
from flask import Blueprint, Response
|
|
|
|
from flask import g
|
|
|
|
"""
|
2019-07-01 20:38:55 +00:00
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2020-01-07 00:25:51 +00:00
|
|
|
"""
|
|
|
|
|
2019-07-01 20:38:55 +00:00
|
|
|
shutdown_bp = Blueprint('shutdown', __name__)
|
|
|
|
|
2020-07-26 02:36:48 +00:00
|
|
|
|
2019-07-01 20:38:55 +00:00
|
|
|
def shutdown(client_api_inst):
|
|
|
|
try:
|
|
|
|
client_api_inst.publicAPI.httpServer.stop()
|
|
|
|
client_api_inst.httpServer.stop()
|
|
|
|
except AttributeError:
|
|
|
|
pass
|
|
|
|
return Response("bye")
|
|
|
|
|
2020-07-26 02:36:48 +00:00
|
|
|
|
2019-07-01 20:38:55 +00:00
|
|
|
@shutdown_bp.route('/shutdownclean')
|
|
|
|
def shutdown_clean():
|
|
|
|
# good for calling from other clients
|
2020-07-26 02:36:48 +00:00
|
|
|
g.too_many.get_by_string("DeadSimpleKV").put('shutdown', True)
|
2020-01-07 00:25:51 +00:00
|
|
|
return Response("bye")
|