Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on docs for yamux.Server(): max 1 per process or per ReadWriteCloser? #134

Open
ErikEngerd opened this issue Aug 22, 2024 · 1 comment

Comments

@ErikEngerd
Copy link

ErikEngerd commented Aug 22, 2024

Hi,

The docs for yamux.Server() say

// Server is used to initialize a new server-side connection.
// There must be at most one server-side connection. If a nil config is
// provided, the DefaultConfiguration will be used.

It is unclear to me if this applies globally or for a single connection. Globally would mean that there is at most only one session in every go process.

I am asking this because in my unit tests there is one test where I am using many yamux.Servers and it looks like messages are getting mixed up. Yet, looking at the source code of yamux I could not see quickly if there is any global state that would limit yamux.Servers to 1 per process. In my application, I am making sure there is at most 1 yamux Server per process, but in my unit test there is one test where I am using many.

So what is the limit? One server per process or one server per connection (ReadWriteCloser)? Also, if there is a limit per process, then where can I see in the source code that there is this limitation?

@ErikEngerd ErikEngerd changed the title Question on docs... Question on docs for yamux.Server(): max 1 per process or per ReadWriteCloser? Aug 22, 2024
@ErikEngerd
Copy link
Author

As occurs many times on github, I am answering my own questions. It turns out there was a sneaky error in the logic of my test case causing connections to be mixed up. Yamux is working fine.

My question is still relevant, although I am quite convinced now that the restriction is per connection not per go process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant