summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a9d8d5)
raw | patch | inline | side by side (parent: 8a9d8d5)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 21 Aug 2009 10:45:54 +0000 (12:45 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 21 Aug 2009 10:45:54 +0000 (12:45 +0200) |
Don't actually send anything when the buffer is empty. Initialize the
buffer in the ‘init’ function.
buffer in the ‘init’ function.
src/http.c | patch | blob | history |
diff --git a/src/http.c b/src/http.c
index 587e31437e5284bdfdf167b156740100ffdc1358..392f8539f4e8296f0e7228223ab9629f09092c3a 100644 (file)
--- a/src/http.c
+++ b/src/http.c
static pthread_mutex_t send_lock = PTHREAD_MUTEX_INITIALIZER;
+static void http_init_buffer (void) /* {{{ */
+{
+ memset (send_buffer, 0, sizeof (send_buffer));
+ send_buffer_free = sizeof (send_buffer);
+ send_buffer_fill = 0;
+ send_buffer_init_time = time (NULL);
+} /* }}} http_init_buffer */
+
static int http_init(void) /* {{{ */
{
curl_easy_setopt (curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
}
+ http_init_buffer ();
+
return (0);
} /* }}} */
return (0);
} /* }}} int http_config */
-static void http_init_buffer (void) /* {{{ */
-{
- memset (send_buffer, 0, sizeof (send_buffer));
- send_buffer_free = sizeof (send_buffer);
- send_buffer_fill = 0;
- send_buffer_init_time = time (NULL);
-} /* }}} http_init_buffer */
-
static int http_send_buffer (char *buffer) /* {{{ */
{
int status = 0;
return (0);
}
+ if (send_buffer_fill <= 0)
+ {
+ send_buffer_init_time = time (NULL);
+ return (0);
+ }
+
status = http_send_buffer (send_buffer);
http_init_buffer ();
http_flush_nolock (/* timeout = */ -1);
curl_easy_cleanup(curl);
return (0);
-}
+} /* }}} int http_shutdown */
void module_register (void) /* {{{ */
{