Merge branch 'v0.6' into issue_1277

This commit is contained in:
coffeedogs 2018-06-19 11:50:13 +01:00 committed by GitHub
commit 86a7311a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -300,7 +300,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
def _command_inv(self, dandelion=False): def _command_inv(self, dandelion=False):
items = self.decode_payload_content("l32s") items = self.decode_payload_content("l32s")
if len(items) >= BMProto.maxObjectCount: if len(items) > BMProto.maxObjectCount:
logger.error("Too many items in %sinv message!", "d" if dandelion else "") logger.error("Too many items in %sinv message!", "d" if dandelion else "")
raise BMProtoExcessiveDataError() raise BMProtoExcessiveDataError()
else: else:

View File

@ -180,7 +180,11 @@ class TCPConnection(BMProto, TLSDispatcher):
for hash, storedValue in bigInvList.items(): for hash, storedValue in bigInvList.items():
payload += hash payload += hash
objectCount += 1 objectCount += 1
if objectCount >= BMProto.maxObjectCount:
# Remove -1 below when sufficient time has passed for users to
# upgrade to versions of PyBitmessage that accept inv with 50,000
# items
if objectCount >= BMProto.maxObjectCount - 1:
sendChunk() sendChunk()
payload = b'' payload = b''
objectCount = 0 objectCount = 0