Remember to turn off has_metacube_header once we have consumed a block.
[cubemap] / input.cpp
index fd71d4072fa64fbd30eb0d584b9b0f0217f01b2a..48465664b56bf7429f1023d44a4ec9d9b7b81f30 100644 (file)
--- a/input.cpp
+++ b/input.cpp
@@ -62,7 +62,7 @@ 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);
@@ -136,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;
        }
 }