catch invalid data error

This commit is contained in:
Jack Robison 2019-02-04 16:03:22 -05:00
parent 377442d9f0
commit c85991704d
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -2,6 +2,7 @@ import asyncio
import logging
import typing
import binascii
from lbrynet.error import InvalidBlobHashError, InvalidDataError
from lbrynet.blob_exchange.serialization import BlobResponse, BlobRequest
if typing.TYPE_CHECKING:
from lbrynet.blob.blob_file import BlobFile
@ -111,6 +112,9 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
return False, True
except asyncio.TimeoutError:
return False, False
except (InvalidBlobHashError, InvalidDataError):
log.warning("invalid blob from %s:%i", self.peer_address, self.peer_port)
return False, False
finally:
await self.close()