Go to the documentation of this file.
66 #define MSG_OUT g_print
67 #define SHOW_VERBOSE 0
68 #define SHOW_PROGRESS 0
109 default:
s =
"CURLM_unknown";
111 MSG_OUT(
"ERROR: %s returns %s\n", where,
s);
160 timeout.tv_sec = timeout_ms/1000;
161 timeout.tv_usec = (timeout_ms%1000)*1000;
163 MSG_OUT(
"*** update_timeout_cb %ld => %ld:%ld ***\n",
175 g->timer_event = g_timeout_add(timeout_ms,
timer_cb, g);
180 static gboolean
event_cb(GIOChannel *ch, GIOCondition condition, gpointer
data)
184 int fd = g_io_channel_unix_get_fd(ch);
198 MSG_OUT(
"last transfer done, kill timeout\n");
213 g_source_remove(
f->ev);
229 g_source_remove(
f->ev);
231 f->ev = g_io_add_watch(
f->ch, kind,
event_cb, g);
240 fdp->
ch = g_io_channel_unix_new(
s);
250 static const char *whatstr[]={
"none",
"IN",
"OUT",
"INOUT",
"REMOVE" };
252 MSG_OUT(
"socket callback: s=%d e=%p what=%s ",
s, e, whatstr[what]);
266 "Changing action from %d to %d\n", fdp->
action, what);
276 size_t realsize =
size * nmemb;
284 static int prog_cb(
void *
p,
double dltotal,
double dlnow,
double ult,
288 MSG_OUT(
"Progress: %s (%g/%g)\n", conn->
url, dlnow, dltotal);
302 MSG_OUT(
"curl_easy_init() failed, exiting!\n");
306 conn->
url = g_strdup(url);
330 static gboolean
fifo_cb(GIOChannel *ch, GIOCondition condition, gpointer
data)
332 #define BUF_SIZE 1024
334 gchar *
buf, *tmp, *all = NULL;
339 rv = g_io_channel_read_line(ch, &
buf, &
len, &tp, &err);
356 all = g_strdup_printf(
"%s%s", tmp,
buf);
374 g_error(
"fifo_cb: %s", err->message);
378 }
while((
len) && (rv == G_IO_STATUS_NORMAL));
385 const char *
fifo =
"hiper.fifo";
388 if(lstat (
fifo, &st) == 0) {
389 if((st.st_mode & S_IFMT) == S_IFREG) {
397 if(mkfifo (
fifo, 0600) == -1) {
402 socket = open(
fifo, O_RDWR | O_NONBLOCK, 0);
413 int main(
int argc,
char **argv)
423 ch = g_io_channel_unix_new(fd);
424 g_io_add_watch(ch, G_IO_IN,
fifo_cb, g);
425 gmain = g_main_loop_new(NULL,
FALSE);
435 g_main_loop_run(gmain);
UNITTEST_START char * ptr
CURL_EXTERN CURLMsg * curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue)
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, void *sockp)
static gboolean timer_cb(gpointer data)
static void new_conn(char *url, GlobalInfo *g)
static gboolean event_cb(GIOChannel *ch, GIOCondition condition, gpointer data)
static void check_multi_info(GlobalInfo *g)
CURL_EXTERN CURL * curl_easy_init(void)
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *curl_handle)
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *curl_handle)
struct _GlobalInfo GlobalInfo
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
static int prog_cb(void *p, double dltotal, double dlnow, double ult, double uln)
CURL_EXTERN void curl_easy_cleanup(CURL *curl)
int stat(const char *path, struct stat *buffer)
#define curl_easy_getinfo(handle, info, arg)
#define curl_easy_setopt(handle, option, value)
static void addsock(curl_socket_t s, CURL *easy, int action, GlobalInfo *g)
#define curl_multi_setopt(handle, opt, param)
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle)
#define CURL_SOCKET_TIMEOUT
static void remsock(SockInfo *f)
struct ev_timer timer_event
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, curl_socket_t s, int ev_bitmask, int *running_handles)
char error[CURL_ERROR_SIZE]
static CURL * easy[MAX_EASY_HANDLES]
static gboolean fifo_cb(GIOChannel *ch, GIOCondition condition, gpointer data)
struct _SockInfo SockInfo
struct _ConnInfo ConnInfo
static int update_timeout_cb(CURLM *multi, long timeout_ms, void *userp)
int main(int argc, char **argv)
static void mcode_or_die(const char *where, CURLMcode code)
CURL_EXTERN CURLM * curl_multi_init(void)
static void setsock(SockInfo *f, curl_socket_t s, CURL *e, int act, GlobalInfo *g)
rc_tagdetect_client
Author(s): Monika Florek-Jasinska
, Raphael Schaller
autogenerated on Sun May 15 2022 02:24:59