Skip to content
Snippets Groups Projects
Commit b5e9810d authored by jkaeber's avatar jkaeber
Browse files

added more meaningful exception text to unix domain sockets

parent 181799f2
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -40,7 +40,7 @@ prefix_ void senf::ConnectedUNDatagramSocketProtocol::init_client() const ...@@ -40,7 +40,7 @@ prefix_ void senf::ConnectedUNDatagramSocketProtocol::init_client() const
{ {
int sock = ::socket(PF_UNIX,SOCK_DGRAM,0); int sock = ::socket(PF_UNIX,SOCK_DGRAM,0);
if (sock < 0) if (sock < 0)
throw SystemException(); throw SystemException( "Could not create socket(PF_UNIX,SOCK_DGRAM,0)" );
fd(sock); fd(sock);
} }
......
...@@ -41,14 +41,19 @@ prefix_ void senf::UNDatagramSocketProtocol::init_client() const ...@@ -41,14 +41,19 @@ prefix_ void senf::UNDatagramSocketProtocol::init_client() const
{ {
int sock = ::socket(PF_UNIX,SOCK_DGRAM,0); int sock = ::socket(PF_UNIX,SOCK_DGRAM,0);
if (sock < 0) if (sock < 0)
throw SystemException(); throw SystemException( "Could not create socket(PF_UNIX,SOCK_DGRAM,0)" );
fd(sock); fd(sock);
} }
prefix_ void senf::UNDatagramSocketProtocol::init_client(UNSocketAddress const & address) const prefix_ void senf::UNDatagramSocketProtocol::init_client(UNSocketAddress const & address) const
{ {
init_client(); init_client();
clientHandle().bind(address); try {
clientHandle().bind(address);
} catch (SystemException & e) {
e << "Could not bind to address " << address.path();
throw;
}
} }
///////////////////////////////cc.e//////////////////////////////////////// ///////////////////////////////cc.e////////////////////////////////////////
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/sockios.h> // for SIOCINQ / SIOCOUTQ #include <linux/sockios.h> // for SIOCINQ / SIOCOUTQ
#include <senf/Utils/Logger.hh>
#include "../../../Utils/Exception.hh" #include "../../../Utils/Exception.hh"
//#include "UNSocketProtocol.mpp" //#include "UNSocketProtocol.mpp"
...@@ -41,7 +42,7 @@ prefix_ unsigned senf::UNSocketProtocol::available() ...@@ -41,7 +42,7 @@ prefix_ unsigned senf::UNSocketProtocol::available()
{ {
int n; int n;
if (::ioctl(fd(),SIOCINQ,&n) < 0) if (::ioctl(fd(),SIOCINQ,&n) < 0)
throw SystemException(); throw SystemException("Could not call available() on UNSocket");
return n; return n;
} }
...@@ -76,6 +77,7 @@ prefix_ void senf::UNSocketProtocol::check_and_unlink() ...@@ -76,6 +77,7 @@ prefix_ void senf::UNSocketProtocol::check_and_unlink()
::unlink(una.path().c_str()); ::unlink(una.path().c_str());
} }
catch (SystemException & e) { catch (SystemException & e) {
SENF_LOG(("UNSocketProtocol::check_and_unlink() failed; " << e.description() ));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment