changeset 39450:9f51fd22ed50

wireprotov2peer: use our CBOR decoder Behavior should be the same in order to preserve backwards compatibility. We obviously want to stream values in this code. We'll do that in subsequent commits. Differential Revision: https://phab.mercurial-scm.org/D4470
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 28 Aug 2018 15:41:09 -0700
parents e5eb67dea6e8
children 5bfab9400daf
files mercurial/wireprotov2peer.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireprotov2peer.py	Tue Aug 28 15:37:55 2018 -0700
+++ b/mercurial/wireprotov2peer.py	Tue Aug 28 15:41:09 2018 -0700
@@ -8,15 +8,15 @@
 from __future__ import absolute_import
 
 from .i18n import _
-from .thirdparty import (
-    cbor,
-)
 from . import (
     encoding,
     error,
     util,
     wireprotoframing,
 )
+from .utils import (
+    cborutil,
+)
 
 def formatrichmessage(atoms):
     """Format an encoded message from the framing protocol."""
@@ -44,13 +44,10 @@
 
     def cborobjects(self):
         """Obtain decoded CBOR objects from this response."""
-        size = self.b.tell()
         self.b.seek(0)
 
-        decoder = cbor.CBORDecoder(self.b)
-
-        while self.b.tell() < size:
-            yield decoder.decode()
+        for v in cborutil.decodeall(self.b.getvalue()):
+            yield v
 
 class clienthandler(object):
     """Object to handle higher-level client activities.