aboutsummaryrefslogtreecommitdiffstats
path: root/docs/examples/hiperfifo.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-09-20 17:00:17 -0700
committerElliott Hughes <enh@google.com>2017-09-21 09:38:15 -0700
commit82be86df6ec7baa34d6169c053fd1dfe56fa858e (patch)
treeafd04b931f1f59dfe81b0daa450306ff0204319b /docs/examples/hiperfifo.c
parentbfa505f61d33429f40bf843b7871fc793dd017d4 (diff)
downloadexternal_curl-82be86df6ec7baa34d6169c053fd1dfe56fa858e.tar.gz
external_curl-82be86df6ec7baa34d6169c053fd1dfe56fa858e.tar.bz2
external_curl-82be86df6ec7baa34d6169c053fd1dfe56fa858e.zip
Update libcurl from 7.54.1 to 7.55.1.
Bug: http://b/64610131 Test: builds, boots, `vendor/google/tools/fake-ota on streaming` works Change-Id: I7ecaf9c83e9496ac4a379507791bec637deaa4cb
Diffstat (limited to 'docs/examples/hiperfifo.c')
-rw-r--r--docs/examples/hiperfifo.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/docs/examples/hiperfifo.c b/docs/examples/hiperfifo.c
index dce009c5..45b69b0d 100644
--- a/docs/examples/hiperfifo.c
+++ b/docs/examples/hiperfifo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -108,8 +108,6 @@ typedef struct _SockInfo
GlobalInfo *global;
} SockInfo;
-
-
/* Update the event timer after curl_multi library calls */
static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
{
@@ -119,6 +117,16 @@ static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
timeout.tv_sec = timeout_ms/1000;
timeout.tv_usec = (timeout_ms%1000)*1000;
fprintf(MSG_OUT, "multi_timer_cb: Setting timeout to %ld ms\n", timeout_ms);
+
+ /* TODO
+ *
+ * if timeout_ms is 0, call curl_multi_socket_action() at once!
+ *
+ * if timeout_ms is -1, just delete the timer
+ *
+ * for all other values of timeout_ms, this should set or *update*
+ * the timer to the new value
+ */
evtimer_add(g->timer_event, &timeout);
return 0;
}
@@ -128,7 +136,7 @@ static void mcode_or_die(const char *where, CURLMcode code)
{
if(CURLM_OK != code) {
const char *s;
- switch (code) {
+ switch(code) {
case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break;
case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break;
case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break;
@@ -300,8 +308,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
/* CURLOPT_PROGRESSFUNCTION */
-static int prog_cb (void *p, double dltotal, double dlnow, double ult,
- double uln)
+static int prog_cb(void *p, double dltotal, double dlnow, double ult,
+ double uln)
{
ConnInfo *conn = (ConnInfo *)p;
(void)ult;
@@ -371,7 +379,7 @@ static void fifo_cb(int fd, short event, void *arg)
/* Create a named pipe and tell libevent to monitor it */
static const char *fifo = "hiper.fifo";
-static int init_fifo (GlobalInfo *g)
+static int init_fifo(GlobalInfo *g)
{
struct stat st;
curl_socket_t sockfd;
@@ -381,18 +389,18 @@ static int init_fifo (GlobalInfo *g)
if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST;
perror("lstat");
- exit (1);
+ exit(1);
}
}
unlink(fifo);
if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo");
- exit (1);
+ exit(1);
}
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) {
perror("open");
- exit (1);
+ exit(1);
}
g->input = fdopen(sockfd, "r");