Treat some invalid objects as received

- update to 6044df5adf
- objects that are expired or in wrong stream are not re-requested
anymore, even if they aren't stored in the inventory
- the previous option "acceptmismatch" now only affects whether such
objects are stored in the inventory
This commit is contained in:
Peter Šurda 2017-06-03 16:29:21 +02:00
parent f78f1a718b
commit a9c0000c17
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -278,12 +278,17 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
self.object.checkProofOfWorkSufficient()
try:
self.object.checkEOLSanity()
except BMObjectExpiredError:
if not BMConfigParser().get("inventory", "acceptmismatch"):
raise
try:
self.object.checkStream()
except BMObjectUnwantedStreamError:
except (BMObjectExpiredError, BMObjectUnwantedStreamError):
for connection in BMConnectionPool().inboundConnections.values() + BMConnectionPool().outboundConnections.values():
try:
del connection.objectsNewtoThem[hashId]
except KeyError:
pass
try:
del connection.objectsNewToMe[hashId]
except KeyError:
pass
if not BMConfigParser().get("inventory", "acceptmismatch"):
raise
self.object.checkAlreadyHave()