mirror of https://gitlab.com/bashrc2/epicyon
Debug
parent
4243b81583
commit
6aa13c40b0
13
blocking.py
13
blocking.py
|
@ -1877,7 +1877,8 @@ def _update_federated_blocks(session, base_dir: str,
|
||||||
block_federated = []
|
block_federated = []
|
||||||
|
|
||||||
if not session:
|
if not session:
|
||||||
print('WARN: No session for update_federated_blocks')
|
print('WARN: federated blocklist ' +
|
||||||
|
'no session for update_federated_blocks')
|
||||||
return block_federated
|
return block_federated
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
|
@ -1894,13 +1895,12 @@ def _update_federated_blocks(session, base_dir: str,
|
||||||
for endpoint in block_federated_endpoints:
|
for endpoint in block_federated_endpoints:
|
||||||
url = endpoint.strip()
|
url = endpoint.strip()
|
||||||
|
|
||||||
if debug:
|
print('federated blocklist Block API endpoint: ' + url)
|
||||||
print('Block API endpoint: ' + url)
|
|
||||||
blocked_json = get_json(signing_priv_key_pem, session, url, headers,
|
blocked_json = get_json(signing_priv_key_pem, session, url, headers,
|
||||||
None, debug, version, http_prefix, None)
|
None, debug, version, http_prefix, None)
|
||||||
if not get_json_valid(blocked_json):
|
if not get_json_valid(blocked_json):
|
||||||
if debug:
|
print('DEBUG: federated blocklist ' +
|
||||||
print('DEBUG: GET blocked collection failed for c2s to ' + url)
|
'GET blocked collection failed for c2s to ' + url)
|
||||||
continue
|
continue
|
||||||
if isinstance(blocked_json, list):
|
if isinstance(blocked_json, list):
|
||||||
# ensure that the size of the list does not become a form of denial
|
# ensure that the size of the list does not become a form of denial
|
||||||
|
@ -1981,17 +1981,20 @@ def save_block_federated_endpoints(base_dir: str,
|
||||||
def run_federated_blocks_daemon(base_dir: str, httpd, debug: bool) -> None:
|
def run_federated_blocks_daemon(base_dir: str, httpd, debug: bool) -> None:
|
||||||
"""Runs the daemon used to update federated blocks
|
"""Runs the daemon used to update federated blocks
|
||||||
"""
|
"""
|
||||||
|
print('DEBUG: federated blocklist 0')
|
||||||
seconds_per_hour = 60 * 60
|
seconds_per_hour = 60 * 60
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
|
|
||||||
session = None
|
session = None
|
||||||
while True:
|
while True:
|
||||||
|
print('DEBUG: federated blocklist 1')
|
||||||
if httpd.session:
|
if httpd.session:
|
||||||
session = httpd.session
|
session = httpd.session
|
||||||
else:
|
else:
|
||||||
session = create_session(httpd.proxy_type)
|
session = create_session(httpd.proxy_type)
|
||||||
|
|
||||||
if session:
|
if session:
|
||||||
|
print('DEBUG: federated blocklist 2')
|
||||||
httpd.block_federated = \
|
httpd.block_federated = \
|
||||||
_update_federated_blocks(httpd.session, base_dir,
|
_update_federated_blocks(httpd.session, base_dir,
|
||||||
httpd.http_prefix,
|
httpd.http_prefix,
|
||||||
|
|
Loading…
Reference in New Issue