X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=udpinput.cpp;h=e58ef9160ba1a1027f85efbcf270c4db8378537e;hb=677f16b5d25f4e7409337b598d35dd5e0f44fe7f;hp=5e39d6632c9b72ca6916816283df44ffa8ef1820;hpb=70c47a998c5aa2eb536c3c8f71f3178cd217a14d;p=cubemap diff --git a/udpinput.cpp b/udpinput.cpp index 5e39d66..e58ef91 100644 --- a/udpinput.cpp +++ b/udpinput.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "acceptor.h" @@ -40,8 +41,9 @@ bool parse_ip_address(const string &ip, sockaddr_storage *addr) ip.c_str()); return false; } - if (inet_pton(AF_INET6, ip.c_str(), &addr6->sin6_addr) != 1) { - log(ERROR, "'%s' is not a valid IPv6 address"); + string raw_ip(ip.begin() + 1, ip.end() - 1); + if (inet_pton(AF_INET6, raw_ip.c_str(), &addr6->sin6_addr) != 1) { + log(ERROR, "'%s' is not a valid IPv6 address", raw_ip.c_str()); return false; } } else { @@ -115,7 +117,9 @@ UDPInput::UDPInput(const string &url) stats.url = url; stats.bytes_received = 0; stats.data_bytes_received = 0; + stats.metadata_bytes_received = 0; stats.connect_time = time(NULL); + stats.latency_sec = HUGE_VAL; } UDPInput::UDPInput(const InputProto &serialized) @@ -148,6 +152,7 @@ InputProto UDPInput::serialize() const serialized.set_bytes_received(stats.bytes_received); serialized.set_data_bytes_received(stats.data_bytes_received); serialized.set_connect_time(stats.connect_time); + serialized.set_is_metacube_encoded(false); return serialized; } @@ -178,7 +183,7 @@ void UDPInput::do_work() while (!should_stop()) { if (sock == -1) { int port_num = atoi(port.c_str()); - sockaddr_in6 addr = CreateAnyAddress(port_num); + sockaddr_in6 addr = create_any_address(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...", @@ -225,7 +230,7 @@ void UDPInput::do_work() } for (size_t i = 0; i < stream_indices.size(); ++i) { - servers->add_data(stream_indices[i], packet_buf, ret, SUITABLE_FOR_STREAM_START); + servers->add_data(stream_indices[i], packet_buf, ret, /*metacube_flags=*/0); } } }