Implement UdpSocketImpl::Close ()
authorTom Henderson <tomh@tomh.org>
Wed, 05 Aug 2009 20:53:44 -0700
changeset 4697 6e048d6486d8
parent 4696 5ef92ccda11a
child 4698 60cd412fa3dd
Implement UdpSocketImpl::Close ()
src/internet-stack/udp-socket-impl.cc
src/node/socket.h
--- a/src/internet-stack/udp-socket-impl.cc	Thu Aug 06 10:23:12 2009 +0400
+++ b/src/internet-stack/udp-socket-impl.cc	Wed Aug 05 20:53:44 2009 -0700
@@ -203,9 +203,16 @@
 }
 
 int
-UdpSocketImpl::Close(void)
+UdpSocketImpl::Close (void)
 {
   NS_LOG_FUNCTION_NOARGS ();
+  if (m_shutdownRecv == true && m_shutdownSend == true)
+    {
+      m_errno = Socket::ERROR_BADF;
+      return -1;
+    }
+  m_shutdownRecv = true;
+  m_shutdownSend = true;
   return 0;
 }
 
--- a/src/node/socket.h	Thu Aug 06 10:23:12 2009 +0400
+++ b/src/node/socket.h	Wed Aug 05 20:53:44 2009 -0700
@@ -184,6 +184,7 @@
 
   /** 
    * \brief Close a socket.
+   * \returns zero on success, -1 on failure.
    *
    * After the Close call, the socket is no longer valid, and cannot
    * safely be used for subsequent operations.