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

Inconsistent timeout unit in NetSocketPosix::poll #48195

Closed
MmAaXx500 opened this issue Apr 25, 2021 · 1 comment · Fixed by #48203
Closed

Inconsistent timeout unit in NetSocketPosix::poll #48195

MmAaXx500 opened this issue Apr 25, 2021 · 1 comment · Fixed by #48203

Comments

@MmAaXx500
Copy link
Contributor

Godot version: Any

OS/device including version: Windows and Linux

Issue description:

Timeout unit is inconsistent in NetSocketPosix::poll.

For example if we input 1000 in p_timeout parameter.
On Windows we place this value in a timeval struct in this way:

struct timeval timeout = { p_timeout, 0 };
witch means 1000 seconds and 0 microseconds.

On Linux we put the parameter directly into poll which takes the timeout in milliseconds:

int ret = ::poll(&pfd, 1, p_timeout);

At the end we waited 1000 milliseconds on Linux and 1000 seconds on Windows which obviously not equal.

p.s.: I'm happily submitting a pr if we decided on the desired unit

Steps to reproduce: n/a

Minimal reproduction project: n/a

@Calinou
Copy link
Member

Calinou commented Apr 25, 2021

cc @Faless

I think microseconds would be better here as they are more granular. Just make sure the documentation is up-to-date on this.

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

Successfully merging a pull request may close this issue.

3 participants