void Server::add_data_deferred(const string &stream_id, const char *data, size_t bytes)
{
MutexLock lock(&queued_data_mutex);
- queued_data[stream_id].append(string(data, data + bytes));
+ find_stream(stream_id)->add_data_deferred(data, bytes);
}
// See the .h file for postconditions after this function.
}
queued_add_clients.clear();
- for (map<string, string>::iterator queued_it = queued_data.begin();
- queued_it != queued_data.end();
- ++queued_it) {
- Stream *stream = find_stream(queued_it->first);
- stream->add_data(queued_it->second.data(), queued_it->second.size());
- stream->wake_up_all_clients();
+ for (map<string, Stream *>::iterator stream_it = streams.begin();
+ stream_it != streams.end();
+ ++stream_it) {
+ stream_it->second->process_queued_data();
}
- queued_data.clear();
}