libp2p / cpp-libp2p

C++17 implementation of libp2p
Apache License 2.0
347 stars 98 forks source link

Yamux newStream does not work #168

Open igor-egorov opened 2 years ago

igor-egorov commented 2 years ago

There are two versions for new stream creation in cpp-libp2p yamux - sync and async. Async version is not working - we always will have an error "closed by remote peer" when we use it. The actual problem is that the stream is created in both cases, but in the case of the async version, it never returned to the user's callback. The second problem is that the stream creation in both cases is done via the same method under the hood, but in the case of the async approach, we have additional messages on the line, which look unnecessary to be sent over. Thus, the flow seems broken in the case of the async approach of streams creation which is generally preferred.