X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=input.cpp;h=541b5df6273bf7e59b0230acbcb1d936f679b977;hp=fd71d4072fa64fbd30eb0d584b9b0f0217f01b2a;hb=6b4c7eecb5910b35ac61452cd5515ff1ee03d1de;hpb=62d560b67de3a922bc26ef5c0c2a72a9a09e7905 diff --git a/input.cpp b/input.cpp index fd71d40..541b5df 100644 --- a/input.cpp +++ b/input.cpp @@ -62,13 +62,15 @@ void Input::do_work() { CURL *curl = curl_easy_init(); - for ( ;; ) { + while (!should_stop) { curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); 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 ended, waiting 0.2 seconds and restarting...\n"); + usleep(200000); + } } } @@ -136,6 +138,7 @@ void Input::curl_callback(char *ptr, size_t bytes) // should we have many blocks, but these routines don't need to be too efficient // anyway. pending_data.erase(pending_data.begin(), pending_data.begin() + sizeof(metacube_block_header) + size); + has_metacube_header = false; } }