aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Socket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-10-28 11:19:18 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-10-28 11:19:18 +0100
commit57c4e58ac139120a971dce184351256712984902 (patch)
treefb810fe9417b4c804e72e7fe243d99729b3949bf /lib/Socket.cpp
parentb79a56d3361f209d1d27a67325e1e5b33998cf8f (diff)
downloadODR-EDI2EDI-57c4e58ac139120a971dce184351256712984902.tar.gz
ODR-EDI2EDI-57c4e58ac139120a971dce184351256712984902.tar.bz2
ODR-EDI2EDI-57c4e58ac139120a971dce184351256712984902.zip
Autoreconnect and handle signals
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;
}