X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=input.cpp;h=48465664b56bf7429f1023d44a4ec9d9b7b81f30;hp=f9f879b6c2a393f6671b42fb25e4462854e04711;hb=286d8e26057bda2f472bbefbb7792ff2ca9f1b65;hpb=6d062eab70fd6528219545846e6c19c1cad35a3d diff --git a/input.cpp b/input.cpp index f9f879b..4846566 100644 --- a/input.cpp +++ b/input.cpp @@ -61,10 +61,15 @@ void *Input::do_work_thunk(void *arg) void Input::do_work() { CURL *curl = curl_easy_init(); - 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); + + 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); + } } size_t Input::curl_callback_thunk(char *ptr, size_t size, size_t nmemb, void *userdata) @@ -131,6 +136,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; } }