Closed tobydox closed 1 year ago
Hi Toby, thanks for the PR!
Some general thoughts:
Are there more pros and cons you can think of? How would you weigh them?
Some resources I know of:
Thanks!
We have customers who actually do establish many VNC connections in parallel on the one hand and on the other hand due to other components in the program allocating file descriptors (pipes, socket notifiers etc.), 1024 file descriptors in total are exceeded quickly. So yes complexity is increased but may be we can also find a better way of structuring the code besides macros (e.g. a polling wrapper which either uses poll()
or select()
).
OK I see. Well my first plan was to use something like libev, libuv or libevent as a base, but I ended up thinking that implementing everything from scratch in Rust using tokio would be the very best approach ;-)
I'll do a in-depth review and then this can probably get merged as an incremental improvement.
Patch rebased / ping
select()
does not work with file descriptors > 1024 so use the more modernpoll()
function if available. This also avoids the overhead of allocating/managing the quite hugefd_set
structure.This is a draft and any feedback, especially about the proper usage of
poll()
in all 3 different cases (waiting for socket connection, waiting for data to be read, waiting for data to be written), is welcome. Of course if there are no objections, the changes also can be merged.