aboutsummaryrefslogtreecommitdiffstats
path: root/common/network/UnixSocket.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'common/network/UnixSocket.cxx')
-rw-r--r--common/network/UnixSocket.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/common/network/UnixSocket.cxx b/common/network/UnixSocket.cxx
index 3a422b6c..c8517300 100644
--- a/common/network/UnixSocket.cxx
+++ b/common/network/UnixSocket.cxx
@@ -29,7 +29,10 @@
#include <stdlib.h>
#include <stddef.h>
+#include <rdr/Exception.h>
+
#include <network/UnixSocket.h>
+
#include <rfb/LogWriter.h>
using namespace network;
@@ -50,12 +53,12 @@ UnixSocket::UnixSocket(const char *path)
socklen_t salen;
if (strlen(path) >= sizeof(addr.sun_path))
- throw SocketException("socket path is too long", ENAMETOOLONG);
+ throw socket_error("socket path is too long", ENAMETOOLONG);
// - Create a socket
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock == -1)
- throw SocketException("unable to create socket", errno);
+ throw socket_error("unable to create socket", errno);
// - Attempt to connect
memset(&addr, 0, sizeof(addr));
@@ -69,7 +72,7 @@ UnixSocket::UnixSocket(const char *path)
}
if (result == -1)
- throw SocketException("unable to connect to socket", err);
+ throw socket_error("unable to connect to socket", err);
setFd(sock);
}
@@ -116,11 +119,11 @@ UnixListener::UnixListener(const char *path, int mode)
int err, result;
if (strlen(path) >= sizeof(addr.sun_path))
- throw SocketException("socket path is too long", ENAMETOOLONG);
+ throw socket_error("socket path is too long", ENAMETOOLONG);
// - Create a socket
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
- throw SocketException("unable to create listening socket", errno);
+ throw socket_error("unable to create listening socket", errno);
// - Delete existing socket (ignore result)
unlink(path);
@@ -135,14 +138,14 @@ UnixListener::UnixListener(const char *path, int mode)
umask(saved_umask);
if (result < 0) {
close(fd);
- throw SocketException("unable to bind listening socket", err);
+ throw socket_error("unable to bind listening socket", err);
}
// - Set socket mode
if (chmod(path, mode) < 0) {
err = errno;
close(fd);
- throw SocketException("unable to set socket mode", err);
+ throw socket_error("unable to set socket mode", err);
}
listen(fd);