X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=input.cpp;h=de7252a3fda672682d15eb1fae2a821852e259f1;hp=48465664b56bf7429f1023d44a4ec9d9b7b81f30;hb=300fecae0b66a632ffee1a291522d62c840a268c;hpb=286d8e26057bda2f472bbefbb7792ff2ca9f1b65 diff --git a/input.cpp b/input.cpp index 4846566..de7252a 100644 --- a/input.cpp +++ b/input.cpp @@ -18,10 +18,11 @@ #include "mutexlock.h" #include "input.h" #include "server.h" +#include "serverpool.h" using namespace std; -extern Server *servers; +extern ServerPool *servers; Input::Input(const string &stream_id, const string &url) : stream_id(stream_id), @@ -67,8 +68,10 @@ void Input::do_work() curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &Input::curl_callback_thunk); curl_easy_setopt(curl, CURLOPT_WRITEDATA, this); curl_easy_perform(curl); - printf("Transfer ended, waiting 0.2 seconds and restarting...\n"); - usleep(200000); + if (!should_stop) { + printf("Transfer of '%s' ended, waiting 0.2 seconds and restarting...\n", url.c_str()); + usleep(200000); + } } } @@ -144,13 +147,9 @@ void Input::process_block(const char *data, uint32_t size, uint32_t flags) { if (flags & METACUBE_FLAGS_HEADER) { string header(data, data + size); - for (int i = 0; i < NUM_SERVERS; ++i) { - servers[i].set_header(stream_id, header); - } + servers->set_header(stream_id, header); } else { - for (int i = 0; i < NUM_SERVERS; ++i) { - servers[i].add_data(stream_id, data, size); - } + servers->add_data(stream_id, data, size); } }