X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=udpinput.cpp;h=3a8beffeabcc8fcfd4aff48e2694f5aaa79603dd;hp=bed7b446a8285d76b921b01ede86097918c2f0e5;hb=5ad72898a682d78330f206c0aa1b8f73f0baf122;hpb=3845193b930d998630bb53b8d4f05a2b54aefd83 diff --git a/udpinput.cpp b/udpinput.cpp index bed7b44..3a8beff 100644 --- a/udpinput.cpp +++ b/udpinput.cpp @@ -1,16 +1,18 @@ +#include +#include +#include #include -#include +#include #include -#include -#include -#include +#include #include #include "acceptor.h" -#include "udpinput.h" +#include "log.h" #include "serverpool.h" -#include "version.h" #include "state.pb.h" +#include "udpinput.h" +#include "version.h" using namespace std; @@ -59,7 +61,7 @@ void UDPInput::close_socket() } while (ret == -1 && errno == EINTR); if (ret == -1) { - perror("close()"); + log_perror("close()"); } sock = -1; @@ -83,7 +85,7 @@ void UDPInput::do_work() int port_num = atoi(port.c_str()); sock = create_server_socket(port_num, UDP_SOCKET); if (sock == -1) { - fprintf(stderr, "WARNING: UDP socket creation failed. Waiting 0.2 seconds and trying again...\n"); + log(WARNING, "UDP socket creation failed. Waiting 0.2 seconds and trying again..."); usleep(200000); continue; } @@ -100,7 +102,7 @@ void UDPInput::do_work() continue; } if (nfds == -1) { - perror("poll"); + log_perror("poll"); close_socket(); continue; } @@ -112,7 +114,7 @@ void UDPInput::do_work() } while (ret == -1 && errno == EINTR); if (ret <= 0) { - perror("recv"); + log_perror("recv"); close_socket(); continue; }