#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),
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);
+ }
}
}
// 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;
}
}
{
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);
}
}