Implement UdpSocketImpl::Close ()
authorTom Henderson <tomh@tomh.org>
Wed Aug 05 20:53:44 2009 -0700 (6 months ago)
changeset 46976e048d6486d8
parent 4696 5ef92ccda11a
child 4698 60cd412fa3dd
Implement UdpSocketImpl::Close ()
src/internet-stack/udp-socket-impl.cc
src/node/socket.h
     1.1 --- a/src/internet-stack/udp-socket-impl.cc	Thu Aug 06 10:23:12 2009 +0400
     1.2 +++ b/src/internet-stack/udp-socket-impl.cc	Wed Aug 05 20:53:44 2009 -0700
     1.3 @@ -203,9 +203,16 @@
     1.4  }
     1.5  
     1.6  int
     1.7 -UdpSocketImpl::Close(void)
     1.8 +UdpSocketImpl::Close (void)
     1.9  {
    1.10    NS_LOG_FUNCTION_NOARGS ();
    1.11 +  if (m_shutdownRecv == true && m_shutdownSend == true)
    1.12 +    {
    1.13 +      m_errno = Socket::ERROR_BADF;
    1.14 +      return -1;
    1.15 +    }
    1.16 +  m_shutdownRecv = true;
    1.17 +  m_shutdownSend = true;
    1.18    return 0;
    1.19  }
    1.20  
     2.1 --- a/src/node/socket.h	Thu Aug 06 10:23:12 2009 +0400
     2.2 +++ b/src/node/socket.h	Wed Aug 05 20:53:44 2009 -0700
     2.3 @@ -184,6 +184,7 @@
     2.4  
     2.5    /** 
     2.6     * \brief Close a socket.
     2.7 +   * \returns zero on success, -1 on failure.
     2.8     *
     2.9     * After the Close call, the socket is no longer valid, and cannot
    2.10     * safely be used for subsequent operations.