now use parse_segment_path to get hash from filename

pull/97/head
Christopher Usher 5 years ago
parent a6303c38ce
commit ccb7f3c684

@ -10,6 +10,7 @@ import signal
import socket import socket
import urlparse import urlparse
import uuid import uuid
from base64 import b64encode
import argh import argh
import gevent.backdoor import gevent.backdoor
@ -125,7 +126,8 @@ def get_remote_segment(base_dir, node, channel, quality, hour, missing_segment,
f.write(chunk) f.write(chunk)
hash.update(chunk) hash.update(chunk)
if hash != common.parse_segment_path(missing_segment).hash: filename_hash = common.parse_segment_path(missing_segment).hash
if filename_hash != hash.digest():
logger.warn('Hash of segment {} does not match. Discarding segment'.format(missing_segment)) logger.warn('Hash of segment {} does not match. Discarding segment'.format(missing_segment))
hash_mismatches.labels(remote=node, channel=channel, quality=quality, hour=hour).inc() hash_mismatches.labels(remote=node, channel=channel, quality=quality, hour=hour).inc()
os.remove(temp_path) os.remove(temp_path)

Loading…
Cancel
Save