Optional storing of expired and off-stream objects
- a new config file option, network/acceptmismatch, allows the inventory to store objects that expired or are from a stream we're not interested in. Having this on will prevent re-requesting objects that other nodes incorrectly advertise. It defaults to false
This commit is contained in:
parent
d75d920a68
commit
6044df5adf
|
@ -21,6 +21,7 @@ BMConfigDefaults = {
|
|||
},
|
||||
"inventory": {
|
||||
"storage": "sqlite",
|
||||
"acceptmismatch": False,
|
||||
},
|
||||
"zlib": {
|
||||
'maxsize': 1048576
|
||||
|
|
|
@ -5,8 +5,6 @@ import math
|
|||
import time
|
||||
import socket
|
||||
import struct
|
||||
import random
|
||||
import traceback
|
||||
|
||||
from addresses import calculateInventoryHash
|
||||
from debug import logger
|
||||
|
@ -278,8 +276,16 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
raise BMProtoExcessiveDataError()
|
||||
|
||||
self.object.checkProofOfWorkSufficient()
|
||||
try:
|
||||
self.object.checkEOLSanity()
|
||||
except BMObjectExpiredError:
|
||||
if not BMConfigParser().get("inventory", "acceptmismatch"):
|
||||
raise
|
||||
try:
|
||||
self.object.checkStream()
|
||||
except BMObjectUnwantedStreamError:
|
||||
if not BMConfigParser().get("inventory", "acceptmismatch"):
|
||||
raise
|
||||
self.object.checkAlreadyHave()
|
||||
|
||||
if self.object.objectType == protocol.OBJECT_GETPUBKEY:
|
||||
|
@ -448,9 +454,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
def handle_close(self, reason=None):
|
||||
self.set_state("close")
|
||||
if reason is None:
|
||||
#logger.debug("%s:%i: closing, %s", self.destination.host, self.destination.port, ''.join(traceback.format_stack()))
|
||||
logger.debug("%s:%i: closing", self.destination.host, self.destination.port)
|
||||
#traceback.print_stack()
|
||||
else:
|
||||
logger.debug("%s:%i: closing, %s", self.destination.host, self.destination.port, reason)
|
||||
AdvancedDispatcher.handle_close(self)
|
||||
|
|
Loading…
Reference in New Issue
Block a user