X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FReadWritePolicy.cc;h=c8426044fca075c8edc8ea94f3fe942a05e746b1;hb=a1fdb7bb122f0b05be809a922d4b7ef5e125fa67;hp=c441f198cd973f581adab2889e9fdbaec351b308;hpb=ac6a813d9d99f7add4e13aff7a4bcd314d5604a6;p=senf.git diff --git a/Socket/ReadWritePolicy.cc b/Socket/ReadWritePolicy.cc index c441f19..c842604 100644 --- a/Socket/ReadWritePolicy.cc +++ b/Socket/ReadWritePolicy.cc @@ -1,9 +1,9 @@ // $Id$ // -// Copyright (C) 2006 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) -// Stefan Bund +// Copyright (C) 2006 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -20,7 +20,9 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// Definition of non-inline non-template functions +/** \file + \brief ReadPolicy and WritePolicy non-inline non-template implementation + */ #include "ReadWritePolicy.hh" //#include "ReadWritePolicy.ih" @@ -51,7 +53,7 @@ prefix_ unsigned senf::ReadablePolicy::read(FileHandle handle, char * buffer, rv = 0; break; default: - throw SystemException(errno); + SENF_THROW_SYSTEM_EXCEPTION(""); } } while (rv<0); return rv; @@ -72,7 +74,7 @@ prefix_ unsigned senf::ReadablePolicy::do_readfrom(FileHandle handle, char * buf rv = 0; break; default: - throw SystemException(errno); + SENF_THROW_SYSTEM_EXCEPTION(""); } } while (rv<0); return rv; @@ -89,10 +91,16 @@ prefix_ unsigned senf::WriteablePolicy::do_write(FileHandle handle, char const * case EINTR: break; case EAGAIN: + case ECONNREFUSED: + // Writing to a UDP socket seems return this error code if a corresponding ICMP + // error code has been received before (at least on linux). This is inconsistent + // since I cannot rely on getting ECONNREFUSED. I therefore ignore this error. TCP + // sockets will return this error on connect() and not on write(). Therefore we can + // unconditionally ignore this error here. rv = 0; break; default: - throw SystemException(errno); + SENF_THROW_SYSTEM_EXCEPTION(""); } } while (rv<0); return rv; @@ -100,7 +108,7 @@ prefix_ unsigned senf::WriteablePolicy::do_write(FileHandle handle, char const * prefix_ unsigned senf::WriteablePolicy::do_writeto(FileHandle handle, char const * buffer, unsigned size, - struct sockaddr * addr, socklen_t len) + struct sockaddr const * addr, socklen_t len) { int rv = -1; do { @@ -113,12 +121,12 @@ prefix_ unsigned senf::WriteablePolicy::do_writeto(FileHandle handle, rv = 0; break; default: - throw SystemException(errno); + SENF_THROW_SYSTEM_EXCEPTION(""); } } while (rv<0); return rv; } - + ///////////////////////////////cc.e//////////////////////////////////////// #undef prefix_ //#include "ReadWritePolicy.mpp" @@ -126,5 +134,10 @@ prefix_ unsigned senf::WriteablePolicy::do_writeto(FileHandle handle, // Local Variables: // mode: c++ +// fill-column: 100 // c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: