Onionr/static-data/official-plugins/tor/shutdown.py
2022-09-26 20:06:05 +00:00

13 lines
349 B
Python

import shelve
from gossip.peerset import gossip_peer_set
from torpeer import TorPeer
from torfilepaths import peer_database_file
def on_shutdown_event(api, data=None):
with shelve.open(peer_database_file, 'c') as db:
for peer in gossip_peer_set:
if isinstance(peer, TorPeer):
db[peer.onion_address] = peer