mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
Protocol muxing (#82)
* Implement protocol muxing * Integrate protocol muxing into new stream and listen's conn handler * Fix bugs in protocol muxing * Remove blank line * Add comments and fix linting issues * Fix order of parameters to select_one_of to match interface * Use array of protocol ids in new stream instead of protocol id * Add basic protocol muxer tests * Add todo * Modify new stream to take in protocol ids * Add check to all tests to ensure protocol id is saved to net stream properly * Lint tests * Fix lint issues * Add todo * Modify port numbers in tests * Fix linting issues * Add more documentation to functions * Add docs describing classes and fix indent error
This commit is contained in:
@ -20,8 +20,10 @@ async def test_simple_messages():
|
||||
|
||||
# Associate the peer with local ip address (see default parameters of Libp2p())
|
||||
node_a.get_peerstore().add_addr("node_b", "/ip4/127.0.0.1/tcp/8000", 10)
|
||||
|
||||
print("node_a about to open stream")
|
||||
stream = await node_a.new_stream("node_b", "/echo/1.0.0")
|
||||
stream = await node_a.new_stream("node_b", ["/echo/1.0.0"])
|
||||
|
||||
messages = ["hello" + str(x) for x in range(10)]
|
||||
for message in messages:
|
||||
await stream.write(message.encode())
|
||||
@ -57,7 +59,7 @@ async def test_double_response():
|
||||
# Associate the peer with local ip address (see default parameters of Libp2p())
|
||||
node_a.get_peerstore().add_addr("node_b", "/ip4/127.0.0.1/tcp/8003", 10)
|
||||
print("node_a about to open stream")
|
||||
stream = await node_a.new_stream("node_b", "/echo/1.0.0")
|
||||
stream = await node_a.new_stream("node_b", ["/echo/1.0.0"])
|
||||
messages = ["hello" + str(x) for x in range(10)]
|
||||
for message in messages:
|
||||
await stream.write(message.encode())
|
||||
|
||||
Reference in New Issue
Block a user