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

Dealing with stacks that need pinning #61

Open
chrysn opened this issue Nov 2, 2021 · 5 comments
Open

Dealing with stacks that need pinning #61

chrysn opened this issue Nov 2, 2021 · 5 comments

Comments

@chrysn
Copy link
Contributor

chrysn commented Nov 2, 2021

Do we have a story for how to deal with stacks that need their sockets pinned?

For example, RIOT's sock_udp_t needs to stay in a place in memory from the time it is connected or bound -- aka be pinned.

The options I see are:

  1. Making all functions that now take &mut socket take a Pin<&mut socket> -- a breaking API change that'd require all general applications to pin their sockets (general applications that can't would require ``ST: UdpStack, ST::Socket: Unpin`).
  2. Using workarounds like currently in riot-wrappers where Stack upon creation has some pinned memory inside which the immovable sockets are created, and where the exposed sockets are just pointers to these.

Is 1. an option on the long run?

@ryan-summers
Copy link
Member

I'm not a fan of forcing implementation details onto all users. If we can pin data internally already, I would say keep things as-is.

How common of a use-case is pinning the socket? I haven't needed anything like this with smoltcp yet

@chrysn
Copy link
Contributor Author

chrysn commented Nov 2, 2021 via email

@chrysn
Copy link
Contributor Author

chrysn commented Nov 3, 2021 via email

@ryan-summers
Copy link
Member

I'm a fan of trying to decouple Socket from the Stack, which I think might resolve this issue? However there's some complexity in trying to do that as well.

@chrysn
Copy link
Contributor Author

chrysn commented Nov 3, 2021

Some decoupling would certainly help -- once the expectation that just because you have a connected socket you can also create more sockets is out of the way, this would be easier.

As things are now (with bound sockets' accept giving new sockets), this only goes so far though; would that be part of the decoupling? (Is that #53, or are there further ideas not discussed there?)

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

2 participants