# HG changeset patch # User Tom Henderson # Date 1249530824 25200 # Node ID bcfb1a0a4229ce2b57c395ca5924ad3faf1b43b0 # Parent 637b9cacd0b5ac09a1f7df62fc556185ed67acc1 Implement UdpSocketImpl::Close () diff -r 637b9cacd0b5 -r bcfb1a0a4229 src/internet-stack/udp-socket-impl.cc --- a/src/internet-stack/udp-socket-impl.cc Mon Jul 27 23:04:19 2009 -0700 +++ b/src/internet-stack/udp-socket-impl.cc Wed Aug 05 20:53:44 2009 -0700 @@ -203,9 +203,16 @@ UdpSocketImpl::ShutdownRecv (void) } 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; } diff -r 637b9cacd0b5 -r bcfb1a0a4229 src/node/socket.h --- a/src/node/socket.h Mon Jul 27 23:04:19 2009 -0700 +++ b/src/node/socket.h Wed Aug 05 20:53:44 2009 -0700 @@ -184,6 +184,7 @@ public: /** * \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.