diff options
Diffstat (limited to 'ace/SOCK_Dgram.cpp')
-rw-r--r-- | ace/SOCK_Dgram.cpp | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp index 6dc776bc4b8..d4c67c16a60 100644 --- a/ace/SOCK_Dgram.cpp +++ b/ace/SOCK_Dgram.cpp @@ -52,9 +52,18 @@ ACE_SOCK_Dgram::recv (iovec *io_vec, { ACE_TRACE ("ACE_SOCK_Dgram::recv"); #if defined (FIONREAD) - if( ACE::handle_read_ready (this->get_handle (), timeout) != 1 ) + switch (ACE::handle_read_ready (this->get_handle (), timeout)) { + case -1: return -1; + /* NOTREACHED */ + case 0: + errno = ETIME; + return -1; + /* NOTREACHED */ + default: + // Goes fine, fallthrough to get data + break; } sockaddr *saddr = (sockaddr *) addr.get_addr (); @@ -426,15 +435,20 @@ ACE_SOCK_Dgram::recv (void *buf, int flags, const ACE_Time_Value *timeout) const { - if( ACE::handle_read_ready (this->get_handle (), timeout) == 1 ) - { - // Goes fine, call <recv> to get data - return this->recv (buf, n, addr, flags); - } - else + switch (ACE::handle_read_ready (this->get_handle (), timeout)) { + case -1: + return -1; + /* NOTREACHED */ + case 0: + errno = ETIME; return -1; + /* NOTREACHED */ + default: + // Goes fine, call <recv> to get data + break; } + return this->recv (buf, n, addr, flags); } ssize_t @@ -445,15 +459,20 @@ ACE_SOCK_Dgram::send (const void *buf, const ACE_Time_Value *timeout) const { // Check the status of the current socket. - if( ACE::handle_write_ready (this->get_handle (), timeout) == 1 ) - { - // Goes fine, call <send> to transmit the data. - return this->send (buf, n, addr, flags); - } - else + switch (ACE::handle_write_ready (this->get_handle (), timeout)) { + case -1: + return -1; + /* NOTREACHED */ + case 0: + errno = ETIME; return -1; + /* NOTREACHED */ + default: + // Goes fine, call <send> to transmit the data. + break; } + return this->send (buf, n, addr, flags); } int |