X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=udpinput.cpp;h=93eaaa76801c0dbab7383e2e7b8902b5fd408ea0;hp=e58ef9160ba1a1027f85efbcf270c4db8378537e;hb=f0621e41fdb96ce1bd58e7561e0aa76345072ba3;hpb=16cc6754518810374f4b486f26646375c4fab12e diff --git a/udpinput.cpp b/udpinput.cpp index e58ef91..93eaaa7 100644 --- a/udpinput.cpp +++ b/udpinput.cpp @@ -113,13 +113,9 @@ UDPInput::UDPInput(const string &url) construct_header(); - pthread_mutex_init(&stats_mutex, NULL); + pthread_mutex_init(&stats_mutex, nullptr); 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; + stats.connect_time = time(nullptr); } UDPInput::UDPInput(const InputProto &serialized) @@ -133,14 +129,14 @@ UDPInput::UDPInput(const InputProto &serialized) construct_header(); - pthread_mutex_init(&stats_mutex, NULL); + pthread_mutex_init(&stats_mutex, nullptr); stats.url = url; stats.bytes_received = serialized.bytes_received(); stats.data_bytes_received = serialized.data_bytes_received(); if (serialized.has_connect_time()) { stats.connect_time = serialized.connect_time(); } else { - stats.connect_time = time(NULL); + stats.connect_time = time(nullptr); } } @@ -206,7 +202,7 @@ void UDPInput::do_work() } // Wait for a packet, or a wakeup. - bool activity = wait_for_activity(sock, POLLIN, NULL); + bool activity = wait_for_activity(sock, POLLIN, nullptr); if (!activity) { // Most likely, should_stop was set. continue; @@ -228,9 +224,9 @@ void UDPInput::do_work() stats.bytes_received += ret; stats.data_bytes_received += ret; } - - for (size_t i = 0; i < stream_indices.size(); ++i) { - servers->add_data(stream_indices[i], packet_buf, ret, /*metacube_flags=*/0); + + for (size_t stream_index : stream_indices) { + servers->add_data(stream_index, packet_buf, ret, /*metacube_flags=*/0); } } }