Comments (3)
Yes, please file an issue in rust-libp2p. The connection upgrade there is always using Mode::Server
for inbound and Mode::Client
for outbound upgrades. libp2p-yamux needs to provide a way to override this. Ideally the transport builder also allows access to the connection info.
from rust-yamux.
Yes, this is expected behaviour. Yamux splits the stream ID space into two non-overlapping sets. The client set consists of odd IDs and the server set of even IDs. See https://github.com/hashicorp/yamux/blob/master/spec.md#streamid-field for details.
A tells B to start connecting to the public address of C. At the same time, A answers to C with the publicly visible IP of B. Both nodes create a socket and then bind it to the same address used to contact node A. It then use this socket to connect. B and C start trying to connect to each other, creating a hole in the NAT.
Even when connections are established by a simultaneous connect, one still needs to make one endpoint the server and the other the client. In general this could be based on the ordering of IP addresses, e.g. the endpoint with the smaller IP address assumes the client role and the other one the server. This is purely needed for the ID space split mentioned above and does not have other implications.
from rust-yamux.
Thanks for your response.
The client set consists of odd IDs and the server set of even IDs
Yes, that's what I understood of the current code.
Even when connections are established by a simultaneous connect, one still needs to make one endpoint the server and the other the client.
I implemented that logic in my PoC and indeed it works fine now. But in a libp2p project, I don't think I can do that. Maybe I should open an issue there with my use case?
from rust-yamux.
Related Issues (20)
- Detect if stream has ended on server side HOT 1
- add chunking in poll_write? HOT 1
- Use type state pattern HOT 4
- Simple client/server example blocks forever HOT 8
- Consider yielding early if we have filled buffers to some degree
- Track the accept backlog and add an upper limit HOT 3
- Re-write interface to buffer streams internally HOT 1
- Remove `futures::Stream` impl from `Stream`
- Remove `ControlledConnection` and everything around it
- Consider increasing `receive_window` default HOT 7
- Dropped `Stream`s are never removed until connection closes? HOT 1
- Refactor `stream::Shared` to use internal mutability
- Doc for v0.12.0 is outdated HOT 2
- refactor: replace `Chunks` with `BytesMut` HOT 2
- chore: remove `WindowUpdateMode::OnReceive` HOT 1
- What is the idiomatic way to create multiple streams? HOT 2
- `poll_new_outbound` without sending data results in no `inbound` stream HOT 2
- Is there any problem with my code and why it doesn't work HOT 5
- buffer of stream grows beyond limit HOT 7
- Missed EOF when reading from a stream and the FIN flag is received in a WindowUpdate frame
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-yamux.