Merge branch 'next-stream-id' of https://github.com/zixuanzh/py-libp2p into next-stream-id

merging in remote
This commit is contained in:
Robert Zajac 2018-11-29 12:56:02 -05:00
commit 49bc5d2f65

View File

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