# HG changeset patch # User Gregory Szorc # Date 1538783358 0 # Node ID 3a6d6c54bd81eb46aa7be295c3ae4c977a4e9b37 # Parent 966b5f7fd30bf2d6a99c0c3e6253e442868d6e31 wireprotov2: don't emit empty frames Staring at logs revealed the presence of empty frames that should have contained payload. Let's stop that from happening. Differential Revision: https://phab.mercurial-scm.org/D4925 diff -r 966b5f7fd30b -r 3a6d6c54bd81 mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py Fri Oct 05 10:29:36 2018 -0700 +++ b/mercurial/wireprotoframing.py Fri Oct 05 23:49:18 2018 +0000 @@ -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, diff -r 966b5f7fd30b -r 3a6d6c54bd81 tests/test-wireproto-serverreactor.py --- a/tests/test-wireproto-serverreactor.py Fri Oct 05 10:29:36 2018 -0700 +++ b/tests/test-wireproto-serverreactor.py Fri Oct 05 23:49:18 2018 +0000 @@ -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 ' ])