X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FReadWritePolicy.cc;h=c8426044fca075c8edc8ea94f3fe942a05e746b1;hb=82e8df5de8b11448423388632e8602ad97bc7885;hp=d5c10c49c7d2975efb95bcc6380594f1cf7f9708;hpb=145f6a7d0f3a6aaa77b3625351c952d24cb0b8a1;p=senf.git diff --git a/Socket/ReadWritePolicy.cc b/Socket/ReadWritePolicy.cc index d5c10c4..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 +// 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 @@ -53,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; @@ -74,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; @@ -91,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; @@ -115,7 +121,7 @@ prefix_ unsigned senf::WriteablePolicy::do_writeto(FileHandle handle, rv = 0; break; default: - throw SystemException(errno); + SENF_THROW_SYSTEM_EXCEPTION(""); } } while (rv<0); return rv;