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

fdwatcher_wait timeout units undefined #5

Closed
adamalcorn opened this issue Aug 29, 2024 · 2 comments
Closed

fdwatcher_wait timeout units undefined #5

adamalcorn opened this issue Aug 29, 2024 · 2 comments

Comments

@adamalcorn
Copy link

kevent implementation treats timeout as seconds but epoll_wait implantation treats timeout as milliseconds.

assuming milliseconds is desired timeout unit, code using kevent could be changed from
ts.tv_sec = timeout;
ts.tv_nsec = 0;
to
ts.tv_sec = timeout / 1000;
ts.tv_nsec = (timeout - (ts.tv_sec*1000)) * 1000000;

Note: epoll_wait timeout in milliseconds is according to https://man7.org/linux/man-pages/man2/epoll_wait.2.html

@bahamas10
Copy link
Owner

very good catch! this is totally undefined in my code and it will result in different behavior for kevent or epoll users. Luckily sshp itself uses -1 so it'll never hit this bug, but if people want to use fdwatcher in the future this should be fixed - i'll write up a fix today.

@bahamas10
Copy link
Owner

fixed in v1.1.3

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