mercurial/wireprotov2server.py
changeset 39467 660879e49b46
parent 37810 856f381ad74b
child 39575 07b58266bce3
--- a/mercurial/wireprotov2server.py	Tue Aug 28 18:05:48 2018 -0700
+++ b/mercurial/wireprotov2server.py	Tue Aug 28 18:12:04 2018 -0700
@@ -9,9 +9,6 @@
 import contextlib
 
 from .i18n import _
-from .thirdparty import (
-    cbor,
-)
 from . import (
     encoding,
     error,
@@ -22,6 +19,7 @@
     wireprototypes,
 )
 from .utils import (
+    cborutil,
     interfaceutil,
 )
 
@@ -302,8 +300,11 @@
     res.status = b'200 OK'
     res.headers[b'Content-Type'] = FRAMINGTYPE
 
+    # TODO consider adding a type to represent an iterable of values to
+    # be CBOR encoded.
     if isinstance(rsp, wireprototypes.cborresponse):
-        encoded = cbor.dumps(rsp.value, canonical=True)
+        # TODO consider calling oncommandresponsereadygen().
+        encoded = b''.join(cborutil.streamencode(rsp.value))
         action, meta = reactor.oncommandresponseready(outstream,
                                                       command['requestid'],
                                                       encoded)