-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
Fix socket timeout for sending & receiving #1753
Conversation
Hi @MateuszKlatecki, I'm nanoFramework bot. A human will be reviewing it shortly. 😉 |
Hi @MateuszKlatecki, 😞 All our issues are tracked in Home repo. If this PR addresses an issue, make sure the reference to it follows the correct pattern: |
Hi @MateuszKlatecki, 😞 All our issues are tracked in Home repo. If this PR addresses an issue, make sure the reference to it follows the correct pattern: |
@@ -661,6 +661,7 @@ HRESULT Library_sys_net_native_System_Net_Sockets_NativeSocket::SendRecvHelper( | |||
CLR_UINT32 offset = stack.Arg2().NumericByRef().u4; | |||
CLR_UINT32 count = stack.Arg3().NumericByRef().u4; | |||
CLR_INT32 flags = stack.Arg4().NumericByRef().s4; | |||
CLR_INT64 sendRecvTimeout = stack.Arg5().NumericByRef().s4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this just timeout
, for simplicity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout variable is already declared in this function to something else.
Since the condition below is not needed, as you can see, this value is only used once, so I won't create a temporary variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's OK too. That's used mostly for debugging purposes. When building with optimisations the compiler would do that anyway.
} | ||
else | ||
{ | ||
hbTimeout.SetInteger(sendRecvTimeout * TIME_CONVERSION__TO_MILLISECONDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK to call this one directly. No need to check for == -1.
The C# guarantees that this will be either -1 or whatever the user has set it.
When setting the value for the timer this is properly checked so no worries here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You rightly noticed. In CLR_RT_ExecutionEngine :: InitTimeout there is already logic that will take care of the correct value.
Description
Set proper timeout value
Motivation and Context
How Has This Been Tested?
Screenshots
Types of changes
Checklist: