D4925: wireprotov2: don't emit empty frames

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Oct 10 10:58:23 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3a6d6c54bd81: wireprotov2: don't emit empty frames (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4925?vs=11764&id=11789

REVISION DETAIL
  https://phab.mercurial-scm.org/D4925

AFFECTED FILES
  mercurial/wireprotoframing.py
  tests/test-wireproto-serverreactor.py

CHANGE DETAILS

diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py
--- a/tests/test-wireproto-serverreactor.py
+++ b/tests/test-wireproto-serverreactor.py
@@ -394,7 +394,6 @@
             b'1 2 0 command-response continuation Y\x80d',
             b'1 2 0 command-response continuation %s' % first,
             b'1 2 0 command-response continuation %s' % second,
-            b'1 2 0 command-response continuation ',
             b'1 2 0 command-response eos '
         ])
 
diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py
--- a/mercurial/wireprotoframing.py
+++ b/mercurial/wireprotoframing.py
@@ -531,6 +531,9 @@
         # * If a chunk causes us to go over our buffering limit, we flush
         #   and then buffer the new chunk.
 
+        if not data:
+            return
+
         if len(data) > self._maxsize:
             for frame in self._flush():
                 yield frame
@@ -573,6 +576,9 @@
         self._chunks[:] = []
         self._chunkssize = 0
 
+        if not payload:
+            return
+
         yield self._stream.makeframe(
             self._requestid,
             typeid=FRAME_TYPE_COMMAND_RESPONSE,



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list