- CURLMsg *msg;
- int nmsg;
-
- global.nrun = nnrun;
-
- syslog(LOG_DEBUG, "CURLEV: gotstatus(): about to call curl_multi_info_read\n");
- while ((msg = curl_multi_info_read(global.mhnd, &nmsg))) {
- syslog(LOG_ERR, "EVCURL: got curl multi_info message msg=%d\n", msg->msg);
- if (CURLMSG_DONE == msg->msg) {
- CURL *chnd;
- char *chandle;
- CURLcode sta;
- CURLMcode msta;
- AsyncIO *IO;
-
- chandle = NULL;;
- chnd = msg->easy_handle;
- sta = curl_easy_getinfo(chnd, CURLINFO_PRIVATE, &chandle);
- syslog(LOG_ERR, "EVCURL: request complete\n");
- if (sta)
- syslog(LOG_ERR, "EVCURL: error asking curl for private cookie of curl handle: %s\n", curl_easy_strerror(sta));
- IO = (AsyncIO *)chandle;
-
- ev_io_stop(event_base, &IO->recv_event);
- ev_io_stop(event_base, &IO->send_event);
-
- sta = msg->data.result;
- if (sta) {
- EV_syslog(LOG_ERR, "EVCURL: error description: %s\n", IO->HttpReq.errdesc);
- EV_syslog(LOG_ERR, "EVCURL: error performing request: %s\n", curl_easy_strerror(sta));
- }
- sta = curl_easy_getinfo(chnd, CURLINFO_RESPONSE_CODE, &IO->HttpReq.httpcode);
- if (sta)
- EV_syslog(LOG_ERR, "EVCURL: error asking curl for response code from request: %s\n", curl_easy_strerror(sta));
- EV_syslog(LOG_ERR, "EVCURL: http response code was %ld\n", (long)IO->HttpReq.httpcode);
-
-
- curl_slist_free_all(IO->HttpReq.headers);
- msta = curl_multi_remove_handle(global.mhnd, chnd);
- if (msta)
- EV_syslog(LOG_ERR, "EVCURL: warning problem detaching completed handle from curl multi: %s\n", curl_multi_strerror(msta));
+ CURLMsg *msg;
+ int nmsg;
+
+ global.nrun = nnrun;
+
+ CURLM_syslog(LOG_DEBUG,
+ "gotstatus(): about to call curl_multi_info_read\n");
+ while ((msg = curl_multi_info_read(global.mhnd, &nmsg))) {
+ CURL_syslog(LOG_DEBUG,
+ "got curl multi_info message msg=%d\n",
+ msg->msg);
+
+ if (CURLMSG_DONE == msg->msg) {
+ CURL *chnd;
+ char *chandle = NULL;
+ CURLcode sta;
+ CURLMcode msta;
+ AsyncIO*IO;
+
+ chandle = NULL;;
+ chnd = msg->easy_handle;
+ sta = curl_easy_getinfo(chnd,
+ CURLINFO_PRIVATE,
+ &chandle);
+ if (sta) {
+ syslog(LOG_ERR,
+ "error asking curl for private"
+ " cookie of curl handle: %s\n",
+ curl_easy_strerror(sta));
+ continue;
+ }
+ IO = (AsyncIO *)chandle;
+ if (IO->ID == 0) {
+ EVCURL_syslog(LOG_ERR,
+ "Error, invalid IO context %p\n",
+ IO);
+ continue;
+ }
+ SetEVState(IO, eCurlGotStatus);
+
+ EVCURLM_syslog(LOG_DEBUG, "request complete\n");
+
+ IO->Now = ev_now(event_base);
+
+ ev_io_stop(event_base, &IO->recv_event);
+ ev_io_stop(event_base, &IO->send_event);
+
+ sta = msg->data.result;
+ if (sta) {
+ EVCURL_syslog(LOG_ERR,
+ "error description: %s\n",
+ IO->HttpReq.errdesc);
+ IO->HttpReq.CurlError = curl_easy_strerror(sta);
+ EVCURL_syslog(LOG_ERR,
+ "error performing request: %s\n",
+ IO->HttpReq.CurlError);
+ if (sta == CURLE_OPERATION_TIMEDOUT)
+ {
+ IO->SendBuf.fd = 0;
+ IO->RecvBuf.fd = 0;
+ }
+ }
+ sta = curl_easy_getinfo(chnd,
+ CURLINFO_RESPONSE_CODE,
+ &IO->HttpReq.httpcode);
+ if (sta)
+ EVCURL_syslog(LOG_ERR,
+ "error asking curl for "
+ "response code from request: %s\n",
+ curl_easy_strerror(sta));
+ EVCURL_syslog(LOG_DEBUG,
+ "http response code was %ld\n",
+ (long)IO->HttpReq.httpcode);
+
+
+ curl_slist_free_all(IO->HttpReq.headers);
+ msta = curl_multi_remove_handle(global.mhnd, chnd);
+ if (msta)
+ EVCURL_syslog(LOG_ERR,
+ "warning problem detaching "
+ "completed handle from curl multi: "
+ "%s\n",
+ curl_multi_strerror(msta));