diff --git a/mercurial/help/internals/wireprotocol.txt b/mercurial/help/internals/wireprotocol.txt --- a/mercurial/help/internals/wireprotocol.txt +++ b/mercurial/help/internals/wireprotocol.txt @@ -668,8 +668,8 @@ server. The command has been fully issued and no new data for this command will be sent. The next frame will belong to a new command. -Response Data (``0x04``) ------------------------- +Command Response Data (``0x03``) +-------------------------------- This frame contains response data to an issued command. diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py +++ b/mercurial/wireprotoframing.py @@ -43,7 +43,7 @@ FRAME_TYPE_COMMAND_REQUEST = 0x01 FRAME_TYPE_COMMAND_DATA = 0x02 -FRAME_TYPE_BYTES_RESPONSE = 0x04 +FRAME_TYPE_COMMAND_RESPONSE = 0x03 FRAME_TYPE_ERROR_RESPONSE = 0x05 FRAME_TYPE_TEXT_OUTPUT = 0x06 FRAME_TYPE_PROGRESS = 0x07 @@ -52,7 +52,7 @@ FRAME_TYPES = { b'command-request': FRAME_TYPE_COMMAND_REQUEST, b'command-data': FRAME_TYPE_COMMAND_DATA, - b'bytes-response': FRAME_TYPE_BYTES_RESPONSE, + b'command-response': FRAME_TYPE_COMMAND_RESPONSE, b'error-response': FRAME_TYPE_ERROR_RESPONSE, b'text-output': FRAME_TYPE_TEXT_OUTPUT, b'progress': FRAME_TYPE_PROGRESS, @@ -79,12 +79,12 @@ b'eos': FLAG_COMMAND_DATA_EOS, } -FLAG_BYTES_RESPONSE_CONTINUATION = 0x01 -FLAG_BYTES_RESPONSE_EOS = 0x02 +FLAG_COMMAND_RESPONSE_CONTINUATION = 0x01 +FLAG_COMMAND_RESPONSE_EOS = 0x02 -FLAGS_BYTES_RESPONSE = { - b'continuation': FLAG_BYTES_RESPONSE_CONTINUATION, - b'eos': FLAG_BYTES_RESPONSE_EOS, +FLAGS_COMMAND_RESPONSE = { + b'continuation': FLAG_COMMAND_RESPONSE_CONTINUATION, + b'eos': FLAG_COMMAND_RESPONSE_EOS, } FLAG_ERROR_RESPONSE_PROTOCOL = 0x01 @@ -99,7 +99,7 @@ FRAME_TYPE_FLAGS = { FRAME_TYPE_COMMAND_REQUEST: FLAGS_COMMAND_REQUEST, FRAME_TYPE_COMMAND_DATA: FLAGS_COMMAND_DATA, - FRAME_TYPE_BYTES_RESPONSE: FLAGS_BYTES_RESPONSE, + FRAME_TYPE_COMMAND_RESPONSE: FLAGS_COMMAND_RESPONSE, FRAME_TYPE_ERROR_RESPONSE: FLAGS_ERROR_RESPONSE, FRAME_TYPE_TEXT_OUTPUT: {}, FRAME_TYPE_PROGRESS: {}, @@ -348,8 +348,8 @@ if done: break -def createbytesresponseframesfrombytes(stream, requestid, data, - maxframesize=DEFAULT_MAX_FRAME_SIZE): +def createcommandresponseframesfrombytes(stream, requestid, data, + maxframesize=DEFAULT_MAX_FRAME_SIZE): """Create a raw frame to send a bytes response from static bytes input. Returns a generator of bytearrays. @@ -357,9 +357,9 @@ # Simple case of a single frame. if len(data) <= maxframesize: - flags = FLAG_BYTES_RESPONSE_EOS + flags = FLAG_COMMAND_RESPONSE_EOS yield stream.makeframe(requestid=requestid, - typeid=FRAME_TYPE_BYTES_RESPONSE, + typeid=FRAME_TYPE_COMMAND_RESPONSE, flags=flags, payload=data) return @@ -371,12 +371,12 @@ done = offset == len(data) if done: - flags = FLAG_BYTES_RESPONSE_EOS + flags = FLAG_COMMAND_RESPONSE_EOS else: - flags = FLAG_BYTES_RESPONSE_CONTINUATION + flags = FLAG_COMMAND_RESPONSE_CONTINUATION yield stream.makeframe(requestid=requestid, - typeid=FRAME_TYPE_BYTES_RESPONSE, + typeid=FRAME_TYPE_COMMAND_RESPONSE, flags=flags, payload=chunk) @@ -608,7 +608,7 @@ return meth(frame) - def onbytesresponseready(self, stream, requestid, data): + def oncommandresponseready(self, stream, requestid, data): """Signal that a bytes response is ready to be sent to the client. The raw bytes response is passed as an argument. @@ -616,8 +616,8 @@ ensureserverstream(stream) def sendframes(): - for frame in createbytesresponseframesfrombytes(stream, requestid, - data): + for frame in createcommandresponseframesfrombytes(stream, requestid, + data): yield frame self._activecommands.remove(requestid) @@ -1039,7 +1039,7 @@ request.state = 'receiving' handlers = { - FRAME_TYPE_BYTES_RESPONSE: self._onbytesresponseframe, + FRAME_TYPE_COMMAND_RESPONSE: self._oncommandresponseframe, } meth = handlers.get(frame.typeid) @@ -1049,14 +1049,14 @@ return meth(request, frame) - def _onbytesresponseframe(self, request, frame): - if frame.flags & FLAG_BYTES_RESPONSE_EOS: + def _oncommandresponseframe(self, request, frame): + if frame.flags & FLAG_COMMAND_RESPONSE_EOS: request.state = 'received' del self._activerequests[request.requestid] return 'responsedata', { 'request': request, - 'expectmore': frame.flags & FLAG_BYTES_RESPONSE_CONTINUATION, - 'eos': frame.flags & FLAG_BYTES_RESPONSE_EOS, + 'expectmore': frame.flags & FLAG_COMMAND_RESPONSE_CONTINUATION, + 'eos': frame.flags & FLAG_COMMAND_RESPONSE_EOS, 'data': frame.payload, } diff --git a/mercurial/wireprotov2server.py b/mercurial/wireprotov2server.py --- a/mercurial/wireprotov2server.py +++ b/mercurial/wireprotov2server.py @@ -302,14 +302,14 @@ res.headers[b'Content-Type'] = FRAMINGTYPE if isinstance(rsp, wireprototypes.bytesresponse): - action, meta = reactor.onbytesresponseready(outstream, - command['requestid'], - rsp.data) + action, meta = reactor.oncommandresponseready(outstream, + command['requestid'], + rsp.data) elif isinstance(rsp, wireprototypes.cborresponse): encoded = cbor.dumps(rsp.value, canonical=True) - action, meta = reactor.onbytesresponseready(outstream, - command['requestid'], - encoded) + action, meta = reactor.oncommandresponseready(outstream, + command['requestid'], + encoded) else: action, meta = reactor.onapplicationerror( _('unhandled response type from wire proto command')) diff --git a/tests/test-http-api-httpv2.t b/tests/test-http-api-httpv2.t --- a/tests/test-http-api-httpv2.t +++ b/tests/test-http-api-httpv2.t @@ -175,7 +175,7 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x01BX\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response s> \r\n s> 0\r\n s> \r\n @@ -202,10 +202,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x01B + s> \x1f\x00\x00\x01\x00\x02\x012 s> X\x1dcustomreadonly bytes response s> \r\n - received frame(size=31; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=31; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: [b'customreadonly bytes response'] @@ -316,7 +316,7 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x01BX\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response s> \r\n s> 0\r\n s> \r\n @@ -439,7 +439,7 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x01BX\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response s> \r\n s> 0\r\n s> \r\n @@ -472,10 +472,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 27\r\n - s> \x1f\x00\x00\x01\x00\x02\x01BX\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x01\x00\x02\x012X\x1dcustomreadonly bytes response s> \r\n s> 27\r\n - s> \x1f\x00\x00\x03\x00\x02\x00BX\x1dcustomreadonly bytes response + s> \x1f\x00\x00\x03\x00\x02\x002X\x1dcustomreadonly bytes response s> \r\n s> 0\r\n s> \r\n @@ -510,10 +510,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 28\r\n - s> \x00\x00\x03\x00\x02\x01B\xa3Fphases@Ibookmarks@Jnamespaces@ + s> \x00\x00\x03\x00\x02\x012\xa3Fphases@Ibookmarks@Jnamespaces@ s> \r\n s> 9\r\n - s> \x01\x00\x00\x01\x00\x02\x00B\xa0 + s> \x01\x00\x00\x01\x00\x02\x002\xa0 s> \r\n s> 0\r\n s> \r\n diff --git a/tests/test-http-protocol.t b/tests/test-http-protocol.t --- a/tests/test-http-protocol.t +++ b/tests/test-http-protocol.t @@ -324,10 +324,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 1e\r\n - s> \x16\x00\x00\x01\x00\x02\x01B + s> \x16\x00\x00\x01\x00\x02\x012 s> \x81T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 s> \r\n - received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: [b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'] diff --git a/tests/test-wireproto-clientreactor.py b/tests/test-wireproto-clientreactor.py --- a/tests/test-wireproto-clientreactor.py +++ b/tests/test-wireproto-clientreactor.py @@ -130,12 +130,13 @@ action, meta = sendframe( reactor, - ffs(b'%d 0 stream-begin 4 0 foo' % request.requestid)) + ffs(b'%d 0 stream-begin command-response 0 foo' % + request.requestid)) self.assertEqual(action, b'responsedata') action, meta = sendframe( reactor, - ffs(b'%d 0 0 4 eos bar' % request.requestid)) + ffs(b'%d 0 0 command-response eos bar' % request.requestid)) self.assertEqual(action, b'responsedata') if __name__ == '__main__': diff --git a/tests/test-wireproto-command-branchmap.t b/tests/test-wireproto-command-branchmap.t --- a/tests/test-wireproto-command-branchmap.t +++ b/tests/test-wireproto-command-branchmap.t @@ -60,11 +60,11 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 78\r\n - s> p\x00\x00\x01\x00\x02\x01B + s> p\x00\x00\x01\x00\x02\x012 s> \xa3Gbranch1\x81T\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88Gbranch2\x81T"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfcGdefault\x82T&\x80Z\xba\x1e`\n s> \x82\xe96a\x14\x9f#\x13\x86j"\x1a{T\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82 s> \r\n - received frame(size=112; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=112; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: {b'branch1': [b'\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81&f\x88'], b'branch2': [b'"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfc'], b'default': [b'&\x80Z\xba\x1e`\n\x82\xe96a\x14\x9f#\x13\x86j"\x1a{', b'\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82']} diff --git a/tests/test-wireproto-command-capabilities.t b/tests/test-wireproto-command-capabilities.t --- a/tests/test-wireproto-command-capabilities.t +++ b/tests/test-wireproto-command-capabilities.t @@ -236,10 +236,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 1d7\r\n - s> \xcf\x01\x00\x01\x00\x02\x01B + s> \xcf\x01\x00\x01\x00\x02\x012 s> \xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0004 s> \r\n - received frame(size=463; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=463; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: [{b'commands': {b'branchmap': {b'args': {}, b'permissions': [b'pull']}, b'capabilities': {b'args': {}, b'permissions': [b'pull']}, b'heads': {b'args': {b'publiconly': False}, b'permissions': [b'pull']}, b'known': {b'args': {b'nodes': [b'deadbeef']}, b'permissions': [b'pull']}, b'listkeys': {b'args': {b'namespace': b'ns'}, b'permissions': [b'pull']}, b'lookup': {b'args': {b'key': b'foo'}, b'permissions': [b'pull']}, b'pushkey': {b'args': {b'key': b'key', b'namespace': b'ns', b'new': b'new', b'old': b'old'}, b'permissions': [b'push']}}, b'compression': [{b'name': b'zstd'}, {b'name': b'zlib'}], b'framingmediatypes': [b'application/mercurial-exp-framing-0004'], b'rawrepoformats': [b'generaldelta', b'revlogv1']}] diff --git a/tests/test-wireproto-command-heads.t b/tests/test-wireproto-command-heads.t --- a/tests/test-wireproto-command-heads.t +++ b/tests/test-wireproto-command-heads.t @@ -52,10 +52,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 48\r\n - s> @\x00\x00\x01\x00\x02\x01B + s> @\x00\x00\x01\x00\x02\x012 s> \x83T\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0bT\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^T)Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A s> \r\n - received frame(size=64; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=64; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: [b'\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0b', b'\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^', b')Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A'] @@ -85,10 +85,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 1e\r\n - s> \x16\x00\x00\x01\x00\x02\x01B + s> \x16\x00\x00\x01\x00\x02\x012 s> \x81Tx\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc s> \r\n - received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: [b'x\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc'] diff --git a/tests/test-wireproto-command-known.t b/tests/test-wireproto-command-known.t --- a/tests/test-wireproto-command-known.t +++ b/tests/test-wireproto-command-known.t @@ -44,10 +44,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 9\r\n - s> \x01\x00\x00\x01\x00\x02\x01B + s> \x01\x00\x00\x01\x00\x02\x012 s> @ s> \r\n - received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: [] @@ -77,10 +77,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> a\r\n - s> \x02\x00\x00\x01\x00\x02\x01B + s> \x02\x00\x00\x01\x00\x02\x012 s> A1 s> \r\n - received frame(size=2; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=2; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: [True] @@ -110,10 +110,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> c\r\n - s> \x04\x00\x00\x01\x00\x02\x01B + s> \x04\x00\x00\x01\x00\x02\x012 s> C101 s> \r\n - received frame(size=4; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=4; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: [True, False, True] diff --git a/tests/test-wireproto-command-listkeys.t b/tests/test-wireproto-command-listkeys.t --- a/tests/test-wireproto-command-listkeys.t +++ b/tests/test-wireproto-command-listkeys.t @@ -48,10 +48,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 28\r\n - s> \x00\x00\x01\x00\x02\x01B + s> \x00\x00\x01\x00\x02\x012 s> \xa3Fphases@Ibookmarks@Jnamespaces@ s> \r\n - received frame(size=32; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=32; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''} @@ -81,10 +81,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 45\r\n - s> =\x00\x00\x01\x00\x02\x01B + s> =\x00\x00\x01\x00\x02\x012 s> \xa2JpublishingDTrueX(be0ef73c17ade3fc89dc41701eb9fc3a91b58282A1 s> \r\n - received frame(size=61; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=61; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: {b'be0ef73c17ade3fc89dc41701eb9fc3a91b58282': b'1', b'publishing': b'True'} @@ -114,10 +114,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 35\r\n - s> -\x00\x00\x01\x00\x02\x01B + s> -\x00\x00\x01\x00\x02\x012 s> \xa1A@X(26805aba1e600a82e93661149f2313866a221a7b s> \r\n - received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: {b'@': b'26805aba1e600a82e93661149f2313866a221a7b'} diff --git a/tests/test-wireproto-command-lookup.t b/tests/test-wireproto-command-lookup.t --- a/tests/test-wireproto-command-lookup.t +++ b/tests/test-wireproto-command-lookup.t @@ -44,10 +44,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 1d\r\n - s> \x15\x00\x00\x01\x00\x02\x01B + s> \x15\x00\x00\x01\x00\x02\x012 s> TBk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0 s> \r\n - received frame(size=21; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=21; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: b'Bk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0' diff --git a/tests/test-wireproto-command-pushkey.t b/tests/test-wireproto-command-pushkey.t --- a/tests/test-wireproto-command-pushkey.t +++ b/tests/test-wireproto-command-pushkey.t @@ -47,10 +47,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 9\r\n - s> \x01\x00\x00\x01\x00\x02\x01B + s> \x01\x00\x00\x01\x00\x02\x012 s> \xf5 s> \r\n - received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: True @@ -78,10 +78,10 @@ s> Transfer-Encoding: chunked\r\n s> \r\n s> 35\r\n - s> -\x00\x00\x01\x00\x02\x01B + s> -\x00\x00\x01\x00\x02\x012 s> \xa1A@X(426bada5c67598ca65036d57d9e4b64b0c1ce7a0 s> \r\n - received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=command-response; flags=eos) s> 0\r\n s> \r\n response: {b'@': b'426bada5c67598ca65036d57d9e4b64b0c1ce7a0'} 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 @@ -211,19 +211,19 @@ results.append(self._sendsingleframe( reactor, ffs(b'1 1 stream-begin command-request new ' b"cbor:{b'name': b'command'}"))) - result = reactor.onbytesresponseready(outstream, 1, b'response1') + result = reactor.oncommandresponseready(outstream, 1, b'response1') self.assertaction(result, b'sendframes') list(result[1][b'framegen']) results.append(self._sendsingleframe( reactor, ffs(b'1 1 stream-begin command-request new ' b"cbor:{b'name': b'command'}"))) - result = reactor.onbytesresponseready(outstream, 1, b'response2') + result = reactor.oncommandresponseready(outstream, 1, b'response2') self.assertaction(result, b'sendframes') list(result[1][b'framegen']) results.append(self._sendsingleframe( reactor, ffs(b'1 1 stream-begin command-request new ' b"cbor:{b'name': b'command'}"))) - result = reactor.onbytesresponseready(outstream, 1, b'response3') + result = reactor.oncommandresponseready(outstream, 1, b'response3') self.assertaction(result, b'sendframes') list(result[1][b'framegen']) @@ -347,10 +347,10 @@ list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) outstream = reactor.makeoutputstream() - result = reactor.onbytesresponseready(outstream, 1, b'response') + result = reactor.oncommandresponseready(outstream, 1, b'response') self.assertaction(result, b'sendframes') self.assertframesequal(result[1][b'framegen'], [ - b'1 2 stream-begin bytes-response eos response', + b'1 2 stream-begin command-response eos response', ]) def testmultiframeresponse(self): @@ -363,11 +363,11 @@ list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) outstream = reactor.makeoutputstream() - result = reactor.onbytesresponseready(outstream, 1, first + second) + result = reactor.oncommandresponseready(outstream, 1, first + second) self.assertaction(result, b'sendframes') self.assertframesequal(result[1][b'framegen'], [ - b'1 2 stream-begin bytes-response continuation %s' % first, - b'1 2 0 bytes-response eos %s' % second, + b'1 2 stream-begin command-response continuation %s' % first, + b'1 2 0 command-response eos %s' % second, ]) def testapplicationerror(self): @@ -392,12 +392,12 @@ self.assertaction(results[0], b'runcommand') outstream = reactor.makeoutputstream() - result = reactor.onbytesresponseready(outstream, 1, b'response') + result = reactor.oncommandresponseready(outstream, 1, b'response') self.assertaction(result, b'noop') result = reactor.oninputeof() self.assertaction(result, b'sendframes') self.assertframesequal(result[1][b'framegen'], [ - b'1 2 stream-begin bytes-response eos response', + b'1 2 stream-begin command-response eos response', ]) def testmultiplecommanddeferresponse(self): @@ -407,15 +407,15 @@ list(sendcommandframes(reactor, instream, 3, b'command2', {})) outstream = reactor.makeoutputstream() - result = reactor.onbytesresponseready(outstream, 1, b'response1') + result = reactor.oncommandresponseready(outstream, 1, b'response1') self.assertaction(result, b'noop') - result = reactor.onbytesresponseready(outstream, 3, b'response2') + result = reactor.oncommandresponseready(outstream, 3, b'response2') self.assertaction(result, b'noop') result = reactor.oninputeof() self.assertaction(result, b'sendframes') self.assertframesequal(result[1][b'framegen'], [ - b'1 2 stream-begin bytes-response eos response1', - b'3 2 0 bytes-response eos response2' + b'1 2 stream-begin command-response eos response1', + b'3 2 0 command-response eos response2' ]) def testrequestidtracking(self): @@ -427,16 +427,16 @@ # Register results for commands out of order. outstream = reactor.makeoutputstream() - reactor.onbytesresponseready(outstream, 3, b'response3') - reactor.onbytesresponseready(outstream, 1, b'response1') - reactor.onbytesresponseready(outstream, 5, b'response5') + reactor.oncommandresponseready(outstream, 3, b'response3') + reactor.oncommandresponseready(outstream, 1, b'response1') + reactor.oncommandresponseready(outstream, 5, b'response5') result = reactor.oninputeof() self.assertaction(result, b'sendframes') self.assertframesequal(result[1][b'framegen'], [ - b'3 2 stream-begin bytes-response eos response3', - b'1 2 0 bytes-response eos response1', - b'5 2 0 bytes-response eos response5', + b'3 2 stream-begin command-response eos response3', + b'1 2 0 command-response eos response1', + b'5 2 0 command-response eos response5', ]) def testduplicaterequestonactivecommand(self): @@ -457,7 +457,7 @@ instream = framing.stream(1) list(sendcommandframes(reactor, instream, 1, b'command1', {})) outstream = reactor.makeoutputstream() - reactor.onbytesresponseready(outstream, 1, b'response') + reactor.oncommandresponseready(outstream, 1, b'response') # We've registered the response but haven't sent it. From the # perspective of the reactor, the command is still active. @@ -474,7 +474,7 @@ instream = framing.stream(1) list(sendcommandframes(reactor, instream, 1, b'command1', {})) outstream = reactor.makeoutputstream() - res = reactor.onbytesresponseready(outstream, 1, b'response') + res = reactor.oncommandresponseready(outstream, 1, b'response') list(res[1][b'framegen']) results = list(sendcommandframes(reactor, instream, 1, b'command1', {}))