summaryrefslogtreecommitdiffstats
path: root/src/socket/SocketReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket/SocketReader.cpp')
-rw-r--r--src/socket/SocketReader.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/socket/SocketReader.cpp b/src/socket/SocketReader.cpp
index 8b3ed7a1..2d1b5c14 100644
--- a/src/socket/SocketReader.cpp
+++ b/src/socket/SocketReader.cpp
@@ -142,9 +142,13 @@ SocketReader::_run()
pfd.revents = 0;
while (!_exit_flag) {
+ if (feof(f)) {
+ break; // Lost connection
+ }
+
// Wait for input to arrive at socket
int ret = poll(&pfd, 1, -1);
- if (ret == -1 || (pfd.revents & (POLLHUP | POLLNVAL))) {
+ if (ret == -1 || (pfd.revents & (POLLERR|POLLHUP|POLLNVAL))) {
break; // Hangup
} else if (!ret) {
continue; // No data, shouldn't happen
@@ -156,6 +160,10 @@ SocketReader::_run()
continue; // Read nothing, e.g. just whitespace
} else if (st) {
fprintf(stderr, "Read error: %s\n", serd_strerror(st));
+ continue;
+ } else if (!_msg_node) {
+ LOG(Raul::error) << "Received empty message" << std::endl;
+ continue;
}
// Build an LV2_Atom at chunk.buf from the message