-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[BUG][MinGW64] Error setting socket timeout #775
Comments
From a quick glance it looks like a mixup between two separate commits/PRs. When ab1762c was committed I can put together a patch but could use help testing the chance since I do not own a windows machine. It might also be a good idea to add a specific |
Hi, |
Hi @dellorogiulio could you try the branch I'm working on over at my fork of the repo. To hopefully prevent this from happening again I spent some time getting the unit tests to compile and run in Windows. Let me know if it's working for you! |
Hi @michael-grunder
The wrong timeout is now fixed (I already test it by myself editing I could imagine that you will merge with Thanks! |
Hi,
I'm recently working with the redis-plus-plus repo which wraps hiredis and I found a very annoying bug: setting a socket timeout of 10ms, it becomes 10s. I'm running MinGW under Windows.
Analyzing the problem with @sewenew, which is the creator of redis-plus-plus, we could have found the bug.
Let me summarize the problem:
net.c
Line 320 a
DWORD timeout_msec
is correctly computed from thetimeval tv
Line 321
to_ptr
is assign to the address oftimeout_msec
(to_ptr
is di facto aDWORD*
)Line 324
to_ptr
is pass tosetsockopt
which iswin32_setsockoption
sockcompat.c
Line 215 casts
optval
(which is aDWORD*
) totimeval*
and this obviously causes the error.I don't understand why the
#ifdef _WIN32
was introduced at line 320, In fact, commenting out line 320, 321, 322, 323 all seems work as expected! Now the timeout is called after the correct amount of milliseconds!Thanks in advance
The text was updated successfully, but these errors were encountered: