Beispiel #1
0
/**
 * Check for finished HTTP responses.
 */
static void
http_multi_info_read(void)
{
	assert(!http_client.locked);
	http_client.locked = true;

	CURLMsg *msg;
	int msgs_in_queue;

	while ((msg = curl_multi_info_read(http_client.multi,
					   &msgs_in_queue)) != NULL) {
		if (msg->msg == CURLMSG_DONE) {
			struct http_request *request =
				http_client_find_request(msg->easy_handle);
			assert(request != NULL);

			long status = 0;
			curl_easy_getinfo(msg->easy_handle,
					  CURLINFO_RESPONSE_CODE, &status);

			http_request_done(request, msg->data.result, status);
		}
	}

	http_client.locked = false;
}
Beispiel #2
0
/**
 * Check for finished HTTP responses.
 */
static void
http_multi_info_read(void)
{
	CURLMsg *msg;
	int msgs_in_queue;

	while ((msg = curl_multi_info_read(http_client.multi, &msgs_in_queue)) != NULL) {
		if (msg->msg == CURLMSG_DONE) {
			struct http_request *request =
				http_client_find_request(msg->easy_handle);
			assert(request != NULL);

			http_request_done(request, msg->data.result);
		}
	}
}