From 4e78098e7c4508d8e72d02807a12f88ba74c3c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 3 May 2013 21:03:54 +0200 Subject: [PATCH] DatagramSocket: don't use absolute timeout 0. * Use relative instead, or else the return value will be B_TIMED_OUT instead of B_WOULD_BLOCK. * This fixes bug #9734. --- headers/private/net/ProtocolUtilities.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/headers/private/net/ProtocolUtilities.h b/headers/private/net/ProtocolUtilities.h index fd4280f740..e296ce3e9e 100644 --- a/headers/private/net/ProtocolUtilities.h +++ b/headers/private/net/ProtocolUtilities.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2010, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2013, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -37,6 +37,7 @@ public: extern net_buffer_module_info* gBufferModule; extern net_stack_module_info* gStackModule; + class NetModuleBundleGetter { public: static net_stack_module_info* Stack() { return gStackModule; } @@ -294,7 +295,7 @@ DECL_DATAGRAM_SOCKET(inline status_t)::SocketStatus(bool peek) const { if (peek) return fSocket->error; - + status_t status = fSocket->error; fSocket->error = B_OK; @@ -345,7 +346,7 @@ DECL_DATAGRAM_SOCKET(inline status_t)::_Wait(bigtime_t timeout) { LockingBase::Unlock(&fLock); status_t status = acquire_sem_etc(fNotify, 1, B_CAN_INTERRUPT - | B_ABSOLUTE_TIMEOUT, timeout); + | (timeout != 0 ? B_ABSOLUTE_TIMEOUT : B_RELATIVE_TIMEOUT), timeout); LockingBase::Lock(&fLock); return status;