/* CURLMOPT_SOCKETFUNCTION */ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) { std::cout << std::endl << __PRETTY_FUNCTION__ << " called" << std::endl; fprintf(MSG_OUT, "\nsock_cb: socket=%d, what=%d, sockp=%p", s, what, sockp); GlobalInfo *g = (GlobalInfo*) cbp; int *actionp = (int *) sockp; const char *whatstr[] = { "none", "IN", "OUT", "INOUT", "REMOVE" }; fprintf(MSG_OUT, "\nsocket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); if (what == CURL_POLL_REMOVE) { fprintf(MSG_OUT, "\n"); remsock(actionp, g); } else { if (!actionp) { fprintf(MSG_OUT, "\nAdding data: %s", whatstr[what]); addsock(s, e, what, g); } else { fprintf(MSG_OUT, "\nChanging action from %s to %s", whatstr[*actionp], whatstr[what]); setsock(actionp, s, e, what, *actionp, g); } } return 0; }
/* CURLMOPT_SOCKETFUNCTION */ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) { GlobalInfo *g = (GlobalInfo*) cbp; SockInfo *fdp = (SockInfo*) sockp; static const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" }; MSG_OUT("socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); if (what == CURL_POLL_REMOVE) { MSG_OUT("\n"); remsock(fdp); } else { if (!fdp) { MSG_OUT("Adding data: %s%s\n", what&CURL_POLL_IN?"READ":"", what&CURL_POLL_OUT?"WRITE":"" ); addsock(s, e, what, g); } else { MSG_OUT( "Changing action from %d to %d\n", fdp->action, what); setsock(fdp, s, e, what, g); } } return 0; }
/* CURLMOPT_SOCKETFUNCTION */ int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) { struct http_m_global *g = (struct http_m_global*) cbp; struct http_m_cell *cell = (struct http_m_cell*)sockp; const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" }; LM_DBG("socket callback: s=%d e=%p what=%s\n", s, e, whatstr[what]); if (what == CURL_POLL_REMOVE) { /* if cell is NULL the handle has been removed by the event callback for timeout */ if (cell) { if (cell->evset && cell->ev) { LM_DBG("freeing event %p\n", cell->ev); event_del(cell->ev); event_free(cell->ev); cell->ev=NULL; cell->evset=0; } } else { LM_DBG("REMOVE action without cell, handler timed out.\n"); } } else { if (!cell) { LM_DBG("Adding data: %s\n", whatstr[what]); addsock(s, e, what, g); } else { LM_DBG("Changing action from %s to %s\n", whatstr[cell->action], whatstr[what]); setsock(cell, s, e, what); } } return 0; }
/* CURLMOPT_SOCKETFUNCTION */ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) { GlobalInfo *g = (GlobalInfo*) cbp; SockInfo *fdp = (SockInfo*) sockp; const char *whatstr[]={ "none", "IN", "OUT", "INOUT", "REMOVE" }; fprintf(MSG_OUT, "socket callback: s=%d e=%p what=%s ", s, e, whatstr[what]); if (what == CURL_POLL_REMOVE) { fprintf(MSG_OUT, "\n"); remsock(fdp); } else { if (!fdp) { fprintf(MSG_OUT, "Adding data: %s\n", whatstr[what]); addsock(s, e, what, g); } else { fprintf(MSG_OUT, "Changing action from %s to %s\n", whatstr[fdp->action], whatstr[what]); setsock(fdp, s, e, what, g); } } return 0; }
/* Notifies about updates on a socket file descriptor */ static int sock_cb(CURL *handle, curl_socket_t curl_soc, int what, void *cbp, void *sockp) { orcout(orcm_debug, "%s handle %p curl_soc %i what %i cbp %p sockp %p\n", __PRETTY_FUNCTION__, handle, curl_soc, what, cbp, sockp); global_info *global = (global_info *)cbp; sock_info *soc = (sock_info *)sockp; const char *whatstr[] = { "none", "IN", "OUT", "INOUT", "REMOVE" }; orcout(orcm_debug, "socket callback: s=%d e=%p what=%s ", curl_soc, handle, whatstr[what]); if (what == CURL_POLL_REMOVE) { orcout(orcm_debug, "\n"); remsock(soc, global); } else { if (!soc) { orcout(orcm_debug, "Adding data: %s\n", whatstr[what]); addsock(curl_soc, handle, what, global); } else { orcout(orcm_debug, "Changing action from %s to %s\n", whatstr[soc->action], whatstr[what]); setsock(soc, curl_soc, handle, what, global); } } return 0; }