From: jkaeber Date: Fri, 7 Dec 2007 13:25:13 +0000 (+0000) Subject: Changed available() method according after chat whith Stefan. X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=f0fa2dfb530b94cc09dd4ee5dfd7044af583b575;p=senf.git Changed available() method according after chat whith Stefan. git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@546 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/Protocols/Raw/TunTapSocketHandle.cc b/Socket/Protocols/Raw/TunTapSocketHandle.cc index c2ab043..9e02d6f 100644 --- a/Socket/Protocols/Raw/TunTapSocketHandle.cc +++ b/Socket/Protocols/Raw/TunTapSocketHandle.cc @@ -69,15 +69,31 @@ prefix_ std::auto_ptr senf::TapProtocol::clone() } prefix_ unsigned senf::TapProtocol::available() - const + const { - if (! body().readable()) - return 0; - ssize_t l = ::recv(body().fd(),0,0,MSG_PEEK | MSG_TRUNC); - if (l < 0) - throwErrno(); - return l; + if (! body().readable()) + return 0; + ssize_t l = ::recv(body().fd(),0,0,MSG_PEEK | MSG_TRUNC); + if (l < 0) + //throwErrno(); + return 1588; + return l; +} + +/* +#include // for SIOCINQ / SIOCOUTQ + +prefix_ unsigned senf::TapProtocol::available() + const +{ + if (! body().readable()) + return 0; + int n; + if (::ioctl(body().fd(),SIOCINQ,&n) < 0) + throwErrno(); + return n; } +*/ prefix_ bool senf::TapProtocol::eof() const