Show More
@@ -668,6 +668,9 b' class stream(object):' | |||
|
668 | 668 | return makeframe(requestid, self.streamid, streamflags, typeid, flags, |
|
669 | 669 | payload) |
|
670 | 670 | |
|
671 | class inputstream(stream): | |
|
672 | """Represents a stream used for receiving data.""" | |
|
673 | ||
|
671 | 674 | def setdecoder(self, name, extraobjs): |
|
672 | 675 | """Set the decoder for this stream. |
|
673 | 676 | |
@@ -675,6 +678,9 b' class stream(object):' | |||
|
675 | 678 | decoded from the stream encoding settings frame payloads. |
|
676 | 679 | """ |
|
677 | 680 | |
|
681 | class outputstream(stream): | |
|
682 | """Represents a stream used for sending data.""" | |
|
683 | ||
|
678 | 684 | def ensureserverstream(stream): |
|
679 | 685 | if stream.streamid % 2: |
|
680 | 686 | raise error.ProgrammingError('server should only write to even ' |
@@ -799,7 +805,7 b' class serverreactor(object):' | |||
|
799 | 805 | _('received frame on unknown inactive stream without ' |
|
800 | 806 | 'beginning of stream flag set')) |
|
801 | 807 | |
|
802 | self._incomingstreams[frame.streamid] = stream(frame.streamid) | |
|
808 | self._incomingstreams[frame.streamid] = inputstream(frame.streamid) | |
|
803 | 809 | |
|
804 | 810 | if frame.streamflags & STREAM_FLAG_ENCODING_APPLIED: |
|
805 | 811 | # TODO handle decoding frames |
@@ -1012,7 +1018,7 b' class serverreactor(object):' | |||
|
1012 | 1018 | streamid = self._nextoutgoingstreamid |
|
1013 | 1019 | self._nextoutgoingstreamid += 2 |
|
1014 | 1020 | |
|
1015 | s = stream(streamid) | |
|
1021 | s = outputstream(streamid) | |
|
1016 | 1022 | self._outgoingstreams[streamid] = s |
|
1017 | 1023 | |
|
1018 | 1024 | return s |
@@ -1372,7 +1378,7 b' class clientreactor(object):' | |||
|
1372 | 1378 | |
|
1373 | 1379 | self._nextrequestid = 1 |
|
1374 | 1380 | # We only support a single outgoing stream for now. |
|
1375 | self._outgoingstream = stream(1) | |
|
1381 | self._outgoingstream = outputstream(1) | |
|
1376 | 1382 | self._pendingrequests = collections.deque() |
|
1377 | 1383 | self._activerequests = {} |
|
1378 | 1384 | self._incomingstreams = {} |
@@ -1485,7 +1491,8 b' class clientreactor(object):' | |||
|
1485 | 1491 | 'without beginning of stream flag set'), |
|
1486 | 1492 | } |
|
1487 | 1493 | |
|
1488 |
self._incomingstreams[frame.streamid] = stream( |
|
|
1494 | self._incomingstreams[frame.streamid] = inputstream( | |
|
1495 | frame.streamid) | |
|
1489 | 1496 | |
|
1490 | 1497 | if frame.streamflags & STREAM_FLAG_ENCODING_APPLIED: |
|
1491 | 1498 | raise error.ProgrammingError('support for decoding stream ' |
General Comments 0
You need to be logged in to leave comments.
Login now