D4920: wireprotov2: establish dedicated classes for input and output streams
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Wed Oct 10 10:57:52 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5d44c4d1d516: wireprotov2: establish dedicated classes for input and output streams (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4920?vs=11759&id=11784
REVISION DETAIL
https://phab.mercurial-scm.org/D4920
AFFECTED FILES
mercurial/wireprotoframing.py
CHANGE DETAILS
diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py
--- a/mercurial/wireprotoframing.py
+++ b/mercurial/wireprotoframing.py
@@ -668,13 +668,19 @@
return makeframe(requestid, self.streamid, streamflags, typeid, flags,
payload)
+class inputstream(stream):
+ """Represents a stream used for receiving data."""
+
def setdecoder(self, name, extraobjs):
"""Set the decoder for this stream.
Receives the stream profile name and any additional CBOR objects
decoded from the stream encoding settings frame payloads.
"""
+class outputstream(stream):
+ """Represents a stream used for sending data."""
+
def ensureserverstream(stream):
if stream.streamid % 2:
raise error.ProgrammingError('server should only write to even '
@@ -799,7 +805,7 @@
_('received frame on unknown inactive stream without '
'beginning of stream flag set'))
- self._incomingstreams[frame.streamid] = stream(frame.streamid)
+ self._incomingstreams[frame.streamid] = inputstream(frame.streamid)
if frame.streamflags & STREAM_FLAG_ENCODING_APPLIED:
# TODO handle decoding frames
@@ -1012,7 +1018,7 @@
streamid = self._nextoutgoingstreamid
self._nextoutgoingstreamid += 2
- s = stream(streamid)
+ s = outputstream(streamid)
self._outgoingstreams[streamid] = s
return s
@@ -1372,7 +1378,7 @@
self._nextrequestid = 1
# We only support a single outgoing stream for now.
- self._outgoingstream = stream(1)
+ self._outgoingstream = outputstream(1)
self._pendingrequests = collections.deque()
self._activerequests = {}
self._incomingstreams = {}
@@ -1485,7 +1491,8 @@
'without beginning of stream flag set'),
}
- self._incomingstreams[frame.streamid] = stream(frame.streamid)
+ self._incomingstreams[frame.streamid] = inputstream(
+ frame.streamid)
if frame.streamflags & STREAM_FLAG_ENCODING_APPLIED:
raise error.ProgrammingError('support for decoding stream '
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list