net/ProtocolUtilities: Correct implementation of MSG_DONTWAIT.
We don't want to restore the timeout from a restarted syscall if MSG_DONTWAIT has been specified.
This commit is contained in:
@@ -367,13 +367,13 @@ DECL_DATAGRAM_SOCKET(inline void)::_NotifyOneReader(bool notifySocket)
|
|||||||
|
|
||||||
DECL_DATAGRAM_SOCKET(inline bigtime_t)::_SocketTimeout(uint32 flags) const
|
DECL_DATAGRAM_SOCKET(inline bigtime_t)::_SocketTimeout(uint32 flags) const
|
||||||
{
|
{
|
||||||
|
if ((flags & MSG_DONTWAIT) != 0)
|
||||||
|
return 0;
|
||||||
if (ModuleBundle::Stack()->is_restarted_syscall())
|
if (ModuleBundle::Stack()->is_restarted_syscall())
|
||||||
return ModuleBundle::Stack()->restore_syscall_restart_timeout();
|
return ModuleBundle::Stack()->restore_syscall_restart_timeout();
|
||||||
|
|
||||||
bigtime_t timeout = fSocket->receive.timeout;
|
bigtime_t timeout = fSocket->receive.timeout;
|
||||||
if ((flags & MSG_DONTWAIT) != 0)
|
if (timeout != 0 && timeout != B_INFINITE_TIMEOUT)
|
||||||
timeout = 0;
|
|
||||||
else if (timeout != 0 && timeout != B_INFINITE_TIMEOUT)
|
|
||||||
timeout += system_time();
|
timeout += system_time();
|
||||||
|
|
||||||
ModuleBundle::Stack()->store_syscall_restart_timeout(timeout);
|
ModuleBundle::Stack()->store_syscall_restart_timeout(timeout);
|
||||||
|
|||||||
Reference in New Issue
Block a user