Fixed a bug which causes problem when RPC body size is bigger than 4096

- Fetching blobs (size>4k) works now
  - Updated the image fetching code in examples/test_client.py
This commit is contained in:
Cheng Guo
2018-05-06 14:55:00 +02:00
committed by Pedro Ferreira
parent 734fe59663
commit b26b56632f
2 changed files with 10 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ import struct
from asyncio import Event, Queue
from enum import Enum
from time import time
from math import ceil
import simplejson
from async_generator import async_generator, yield_
@@ -134,8 +135,9 @@ class PacketStream(object):
if not header or header == b'\x00' * 9:
return
flags, length, req = struct.unpack('>BIi', header)
logger.debug('flags=%s length=%s req=%s', flags, length, req)
n_packets = length // 4096 + 1
n_packets = ceil(length / 4096)
body = b''
for n in range(n_packets):