diff options
Diffstat (limited to 'src/server/SocketListener.cpp')
-rw-r--r-- | src/server/SocketListener.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/server/SocketListener.cpp b/src/server/SocketListener.cpp index 445374c4..fb961ee2 100644 --- a/src/server/SocketListener.cpp +++ b/src/server/SocketListener.cpp @@ -19,15 +19,16 @@ #include "Engine.hpp" #include "SocketServer.hpp" -#include "ingen/Atom.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/Log.hpp" -#include "ingen/URI.hpp" -#include "ingen/World.hpp" -#include "raul/Socket.hpp" +#include <ingen/Atom.hpp> +#include <ingen/Configuration.hpp> +#include <ingen/Log.hpp> +#include <ingen/URI.hpp> +#include <ingen/World.hpp> +#include <raul/Socket.hpp> #include <poll.h> #include <sys/stat.h> +#include <sys/types.h> #include <unistd.h> #include <cerrno> @@ -40,8 +41,7 @@ #include <string> #include <thread> -namespace ingen { -namespace server { +namespace ingen::server { static constexpr const char* const unix_scheme = "unix://"; @@ -51,7 +51,7 @@ get_link_target(const char* link_path) // Stat the link to get the required size for the target path struct stat link_stat{}; if (lstat(link_path, &link_stat)) { - return std::string(); + return {}; } // Allocate buffer and read link target @@ -63,7 +63,7 @@ get_link_target(const char* link_path) } free(target); - return std::string(); + return {}; } static void ingen_listen(Engine* engine, @@ -141,7 +141,7 @@ ingen_listen(Engine* engine, raul::Socket* unix_sock, raul::Socket* net_sock) } if (unix_sock->fd() == -1 && net_sock->fd() == -1) { - return; // No sockets to listen to, exit thread + return; // No sockets to listen to, exit thread } struct pollfd pfds[2]; @@ -165,10 +165,14 @@ ingen_listen(Engine* engine, raul::Socket* unix_sock, raul::Socket* net_sock) if (ret == -1) { world.log().error("Poll error: %1%\n", strerror(errno)); break; - } else if (ret == 0) { + } + + if (ret == 0) { world.log().warn("Poll returned with no data\n"); continue; - } else if ((pfds[0].revents & POLLHUP) || pfds[1].revents & POLLHUP) { + } + + if ((pfds[0].revents & POLLHUP) || pfds[1].revents & POLLHUP) { break; } @@ -192,5 +196,4 @@ ingen_listen(Engine* engine, raul::Socket* unix_sock, raul::Socket* net_sock) } } -} // namespace server -} // namespace ingen +} // namespace ingen::server |