From: g0dil Date: Thu, 26 Feb 2009 12:48:57 +0000 (+0000) Subject: Socket: Move shutdown from SocketProtocol::close() to INetSocketProtocol::close() X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=4b3185743975a8a34ad4a1a111a8119b729d49b2;p=senf.git Socket: Move shutdown from SocketProtocol::close() to INetSocketProtocol::close() git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1135 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/Protocols/INet/TCPSocketProtocol.cc b/Socket/Protocols/INet/TCPSocketProtocol.cc index 781b5e6..5f49a44 100644 --- a/Socket/Protocols/INet/TCPSocketProtocol.cc +++ b/Socket/Protocols/INet/TCPSocketProtocol.cc @@ -79,7 +79,14 @@ prefix_ void senf::TCPSocketProtocol::shutdown(ShutType type) const { if (::shutdown(fd(), type) < 0) - SENF_THROW_SYSTEM_EXCEPTION(""); + SENF_THROW_SYSTEM_EXCEPTION("::shutdown()"); +} + +prefix_ void senf::TCPSocketProtocol::close() + const +{ + shutdown(ShutRDWR); + INetSocketProtocol::close(); } prefix_ unsigned senf::TCPSocketProtocol::available() diff --git a/Socket/Protocols/INet/TCPSocketProtocol.hh b/Socket/Protocols/INet/TCPSocketProtocol.hh index d11578c..91021a0 100644 --- a/Socket/Protocols/INet/TCPSocketProtocol.hh +++ b/Socket/Protocols/INet/TCPSocketProtocol.hh @@ -66,6 +66,7 @@ namespace senf { ///\name Abstract Interface Implementation ///@{ + void close() const; unsigned available() const; bool eof() const; diff --git a/Socket/SocketProtocol.cc b/Socket/SocketProtocol.cc index 67ed340..5e15222 100644 --- a/Socket/SocketProtocol.cc +++ b/Socket/SocketProtocol.cc @@ -37,8 +37,6 @@ prefix_ void senf::SocketProtocol::close() const { - if (::shutdown(body().fd(),SHUT_RDWR) < 0) - SENF_THROW_SYSTEM_EXCEPTION("::shutdown(socket_fd)"); if (::close(body().fd()) < 0) SENF_THROW_SYSTEM_EXCEPTION("::close(socket_fd)"); }