summaryrefslogtreecommitdiffstats
path: root/lib/Socket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-10-28 11:24:09 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-10-28 11:24:09 +0100
commit04e1872b5373a4b0bde548e9e42a6c2fc74c7e5d (patch)
tree545756853af063238b61e86c6166f895cf3cda0f /lib/Socket.cpp
parent425d891ad3d04085d9e16893d6e5e580eb68982b (diff)
downloaddabmod-04e1872b5373a4b0bde548e9e42a6c2fc74c7e5d.tar.gz
dabmod-04e1872b5373a4b0bde548e9e42a6c2fc74c7e5d.tar.bz2
dabmod-04e1872b5373a4b0bde548e9e42a6c2fc74c7e5d.zip
common 81f518d: TCPSocket: let recv throw Interrupted on EINTR
Diffstat (limited to 'lib/Socket.cpp')
-rw-r--r--lib/Socket.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Socket.cpp b/lib/Socket.cpp
index bc1b179..d41ed1c 100644
--- a/lib/Socket.cpp
+++ b/lib/Socket.cpp
@@ -630,8 +630,13 @@ ssize_t TCPSocket::recv(void *buffer, size_t length, int flags)
{
ssize_t ret = ::recv(m_sock, buffer, length, flags);
if (ret == -1) {
- std::string errstr(strerror(errno));
- throw std::runtime_error("TCP receive error: " + errstr);
+ if (errno == EINTR) {
+ throw Interrupted();
+ }
+ else {
+ std::string errstr(strerror(errno));
+ throw std::runtime_error("TCP receive error: " + errstr);
+ }
}
return ret;
}