updated logic to avoid conflicts in next stream id selection

This commit is contained in:
Alex Haynes 2018-11-28 21:19:54 -05:00
parent 7fa674dee2
commit 50157aa070

View File

@ -23,7 +23,7 @@ class Mplex(IMuxedConn):
self.buffers = {}
self.stream_queue = asyncio.Queue()
self._next_id = 0
self._next_id = 0 if self.initiator else 1
self.data_buffer = bytearray()
# The initiator need not read upon construction time.
@ -37,7 +37,7 @@ class Mplex(IMuxedConn):
:return: next available stream id for the connection
"""
next_id = self._next_id
self._next_id += 1
self._next_id += 2
return next_id
def close(self):