]> git.sesse.net Git - cubemap/blobdiff - udpinput.cpp
Add a listen statement to listen on only specific IP addresses, in addition to the...
[cubemap] / udpinput.cpp
index 96e0607d7d27dcb5071d2e14202e09eedd547179..6b1779989f26d4a55abe928d6af7ae9553525f3b 100644 (file)
@@ -4,6 +4,7 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <sys/socket.h>
+#include <time.h>
 #include <unistd.h>
 #include <string>
 
@@ -12,6 +13,7 @@
 #include "mutexlock.h"
 #include "serverpool.h"
 #include "state.pb.h"
+#include "stream.h"
 #include "udpinput.h"
 #include "util.h"
 #include "version.h"
@@ -98,7 +100,8 @@ void UDPInput::do_work()
        while (!should_stop()) {
                if (sock == -1) {
                        int port_num = atoi(port.c_str());
-                       sock = create_server_socket(port_num, UDP_SOCKET);
+                       sockaddr_in6 addr = CreateAnyAddress(port_num);
+                       sock = create_server_socket(addr, UDP_SOCKET);
                        if (sock == -1) {
                                log(WARNING, "[%s] UDP socket creation failed. Waiting 0.2 seconds and trying again...",
                                             url.c_str());