Only use pure-python msgpack for socket streaming

This commit is contained in:
shortcutme 2017-08-09 14:17:58 +02:00
parent bdb5e1597c
commit 4f729aa98f
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
2 changed files with 4 additions and 3 deletions

View File

@ -220,7 +220,7 @@ class Config(object):
self.parser.add_argument('--stream_downloads', help='Stream download directly to files (experimental)',
type='bool', choices=[True, False], default=False)
self.parser.add_argument("--msgpack_purepython", help='Use less memory, but a bit more CPU power',
type='bool', choices=[True, False], default=True)
type='bool', choices=[True, False], default=False)
self.parser.add_argument("--fix_float_decimals", help='Fix content.json modification date float precision on verification',
type='bool', choices=[True, False], default=fix_float_decimals)
self.parser.add_argument("--db_mode", choices=["speed", "security"], default="speed")

View File

@ -3,6 +3,7 @@ import time
import gevent
import msgpack
import msgpack.fallback
from Config import config
from Debug import Debug
@ -138,7 +139,7 @@ class Connection(object):
self.connected = True
buff_len = 0
self.unpacker = msgpack.Unpacker()
self.unpacker = msgpack.fallback.Unpacker() # Due memory problems of C version
try:
while not self.closed:
buff = self.sock.recv(16 * 1024)
@ -153,7 +154,7 @@ class Connection(object):
self.server.bytes_recv += buff_len
if not self.unpacker:
self.unpacker = msgpack.Unpacker()
self.unpacker = msgpack.fallback.Unpacker()
self.unpacker.feed(buff)
buff = None
for message in self.unpacker: