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

gio: Add a method to get a stream of incoming connections to SocketListener #1454

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

carlosmn
Copy link
Contributor

@carlosmn carlosmn commented Jul 8, 2024

This object provides a Stream over which we can iterate in order to accept connections in an async environment.

This is analogous to the one provided by async-std's TcpListener.

This is an attempt at #1064. As I mention there, I think SocketService is the wrong abstraction to use in async so this is implemented for SocketListener, so that this incoming() is by itself an alternative to SocketService.

The type that we return here feels pretty awkward but it's what this returns. The pattern with the source object feels like another instance of something that makes sense without easy async but with async Rust you'd create multiple objects? But maybe I don't see other use-cases for it here.

@carlosmn carlosmn force-pushed the cmn/socket-listener-stream branch from 243fcda to c0a45d5 Compare July 8, 2024 09:01
gio/src/socket_listener.rs Outdated Show resolved Hide resolved
Copy link
Member

@sdroege sdroege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good otherwise, thanks!

@carlosmn carlosmn force-pushed the cmn/socket-listener-stream branch from c0a45d5 to b2d317b Compare July 8, 2024 15:04
@carlosmn
Copy link
Contributor Author

carlosmn commented Jul 8, 2024

Alright, updated. I think the change in Gir.toml is right, but it's the first time I've had to touch something like that.

gio/Gir.toml Outdated Show resolved Hide resolved
@carlosmn carlosmn force-pushed the cmn/socket-listener-stream branch from b2d317b to f4b72a1 Compare July 8, 2024 20:16
@carlosmn carlosmn force-pushed the cmn/socket-listener-stream branch from f4b72a1 to 68d5827 Compare July 9, 2024 05:44
gio/src/lib.rs Outdated Show resolved Hide resolved
@carlosmn carlosmn force-pushed the cmn/socket-listener-stream branch 2 times, most recently from 7bab98a to a99b4cc Compare July 9, 2024 09:18
…stener

This object provides a `Stream` over which we can iterate in order to accept
connections in an async environment.

This is analogous to the one provided by async-std's `TcpListener`.
@carlosmn carlosmn force-pushed the cmn/socket-listener-stream branch from a99b4cc to 7792104 Compare July 9, 2024 12:26
@carlosmn carlosmn force-pushed the cmn/socket-listener-stream branch from 7792104 to 08b94be Compare July 9, 2024 12:31
@carlosmn
Copy link
Contributor Author

carlosmn commented Jul 9, 2024

Well after way too much trial-and-error, this should be good to go now, but I don't understand that "docs embed" check as it seems to be about some bit flags.

@sdroege sdroege merged commit b2d7678 into gtk-rs:master Jul 9, 2024
46 of 48 checks passed
@sdroege
Copy link
Member

sdroege commented Jul 9, 2024

but I don't understand that "docs embed" check as it seems to be about some bit flags.

There's something broken with that check. Every now and then it reports errors like this for no reason.

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

Successfully merging this pull request may close these issues.

3 participants