Onionr/static-data/default-plugins/tor/shutdown.py
2022-05-30 19:52:03 -05: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