diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-10-28 11:25:09 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-10-28 11:25:09 +0100 |
commit | 69d683e8720996c571c11b6f90e008682d0f95fb (patch) | |
tree | d652b87d0ca2ca6938a9f6dc54448e10150af17d /contrib/Socket.cpp | |
parent | dc959aa6b105056cafc9e6f98b84c8abda309ca8 (diff) | |
download | ODR-AudioEnc-69d683e8720996c571c11b6f90e008682d0f95fb.tar.gz ODR-AudioEnc-69d683e8720996c571c11b6f90e008682d0f95fb.tar.bz2 ODR-AudioEnc-69d683e8720996c571c11b6f90e008682d0f95fb.zip |
common 81f518d: TCPSocket: let recv throw Interrupted on EINTR
Diffstat (limited to 'contrib/Socket.cpp')
-rw-r--r-- | contrib/Socket.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/Socket.cpp b/contrib/Socket.cpp index bc1b179..d41ed1c 100644 --- a/contrib/Socket.cpp +++ b/contrib/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; } |