-
-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] are the curl_multi::get_info
and curl_multi::is_finished
methods broken?
#76
Comments
if you don't have any major objections I can try to submit a patch in the next days |
Sure you can! @cinghiale |
@cinghiale any news about the patch? :) |
@JosephP91 I don't think he's coming back to fix this xd |
@czaarek99 I hope nothing bad happened to him! |
Seems like I have been ran into this exact issue, and it is way too critical. To test this, I've made a server script that responds in 5s, and then added 100 requests into the I'm updating requests in that manner:
m_requests.remove_if([=](RequestPtr &it) -> bool {
if (m_transport.is_finished(it->getTransport())) {
it->done();
m_transport.remove(it->getTransport());
return true;
}
return false;
}); In most cases I only get 5 respons out of 100. And server gives valid 100 responses! Seems like it's a bad design to check requests like this and I need to use |
I've added a method while ((next = m_transport.get_next_finished())) {
std::unordered_map<curl::curl_easy*, RequestPtr>::const_iterator it = m_requests.find(next);
if (it != m_requests.end()) {
const RequestPtr& request = it->second;
request->done();
m_transport.remove(*next);
m_requests.erase(it);
}
} 100 out of 100 is received. |
@desertkun I've enriched the get_next_finished. Now it returns a complete message with the related curl_easy object. |
IIUC the documentation every messages are returned only once and then removed from the internal handle.
But
curl_multi::is_finished
consumes all the queue searching for a specificeasy handle
, discarding the messages it is not interested in.The first call to
curl_multi::is_finished
could discard a message foreasy2
.What if we add an
unordered_map[easy_handle->message]
in thecurl_multi
class in order to store the messages returned bycurl_multi_info_read
(overwrite the old ones should be ok)?According to this answer on stackoverflow in order to reuse an easy handle you have to remove it, change and then re-add to the multi instance; if so we can cleanup the messages map during the remove phase.
The text was updated successfully, but these errors were encountered: