summaryrefslogtreecommitdiff
path: root/ACE/ace/SOCK_Dgram.cpp
diff options
context:
space:
mode:
authorvzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-09-02 14:51:58 +0000
committervzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-09-02 14:51:58 +0000
commit9d52cd71390d9e0de7d6461bc186b9da28f2b652 (patch)
treeb12714f96f26114214f514ee8c1fe6bdc34d2706 /ACE/ace/SOCK_Dgram.cpp
parent74a8ffda3b866a763ca5c0d54b2ab4cf41ce206a (diff)
downloadATCD-9d52cd71390d9e0de7d6461bc186b9da28f2b652.tar.gz
Thu Sep 2 14:46:56 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com>
* ace/Acceptor.cpp: * ace/SOCK_IO.cpp: * ace/SOCK_Dgram.cpp: * ace/ACE.cpp: * tests/SOCK_Test.cpp: * tests/MT_SOCK_Test.cpp: * NEWS: Reverted both commits by Steve Huston related to handle_ready() and a NEWS entry. Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com> Fri Aug 27 19:17:11 UTC 2010 Steve Huston <shuston@riverace.com> This is necessary for a quick release of 1.8.2.
Diffstat (limited to 'ACE/ace/SOCK_Dgram.cpp')
-rw-r--r--ACE/ace/SOCK_Dgram.cpp61
1 files changed, 54 insertions, 7 deletions
diff --git a/ACE/ace/SOCK_Dgram.cpp b/ACE/ace/SOCK_Dgram.cpp
index 8b546553df4..9df9dcb6094 100644
--- a/ACE/ace/SOCK_Dgram.cpp
+++ b/ACE/ace/SOCK_Dgram.cpp
@@ -2,11 +2,13 @@
#include "ace/SOCK_Dgram.h"
+#include "ace/Handle_Set.h"
#include "ace/Log_Msg.h"
#include "ace/INET_Addr.h"
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
+#include "ace/OS_NS_sys_select.h"
#include "ace/OS_NS_ctype.h"
#include "ace/os_include/net/os_if.h"
#include "ace/Truncate.h"
@@ -50,7 +52,23 @@ ACE_SOCK_Dgram::recv (iovec *io_vec,
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
#if defined (FIONREAD)
- switch (ACE::handle_read_ready (this->get_handle (), timeout))
+ ACE_Handle_Set handle_set;
+ handle_set.reset ();
+ handle_set.set_bit (this->get_handle ());
+
+ // Check the status of the current socket to make sure there's data
+ // to recv (or time out).
+# if defined (ACE_WIN32)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ int select_width = 0;
+# else
+ int select_width = int (this->get_handle ()) + 1;
+# endif /* ACE_WIN32 */
+ switch (ACE_OS::select (select_width,
+ handle_set,
+ 0, 0,
+ timeout))
{
case -1:
return -1;
@@ -433,7 +451,23 @@ ACE_SOCK_Dgram::recv (void *buf,
int flags,
const ACE_Time_Value *timeout) const
{
- switch (ACE::handle_read_ready (this->get_handle (), timeout))
+ ACE_Handle_Set handle_set;
+ handle_set.reset ();
+ handle_set.set_bit (this->get_handle ());
+
+ // Check the status of the current socket.
+#if defined (ACE_WIN32)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ int select_width = 0;
+#else
+ int select_width = int (this->get_handle ()) + 1;
+#endif /* ACE_WIN32 */
+ switch (ACE_OS::select (select_width,
+ handle_set,
+ 0,
+ 0,
+ timeout))
{
case -1:
return -1;
@@ -444,9 +478,8 @@ ACE_SOCK_Dgram::recv (void *buf,
/* NOTREACHED */
default:
// Goes fine, call <recv> to get data
- break;
+ return this->recv (buf, n, addr, flags);
}
- return this->recv (buf, n, addr, flags);
}
ssize_t
@@ -456,8 +489,23 @@ ACE_SOCK_Dgram::send (const void *buf,
int flags,
const ACE_Time_Value *timeout) const
{
+ ACE_Handle_Set handle_set;
+ handle_set.reset ();
+ handle_set.set_bit (this->get_handle ());
+
// Check the status of the current socket.
- switch (ACE::handle_write_ready (this->get_handle (), timeout))
+#if defined (ACE_WIN32)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ int select_width = 0;
+#else
+ int select_width = int (this->get_handle ()) + 1;
+#endif /* ACE_WIN32 */
+ switch (ACE_OS::select (select_width,
+ 0,
+ handle_set,
+ 0,
+ timeout))
{
case -1:
return -1;
@@ -468,9 +516,8 @@ ACE_SOCK_Dgram::send (const void *buf,
/* NOTREACHED */
default:
// Goes fine, call <send> to transmit the data.
- break;
+ return this->send (buf, n, addr, flags);
}
- return this->send (buf, n, addr, flags);
}
int