projects
/
framework
/
connectivity
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
21277c9
)
Fix up test tool for web service library
author
Marcel Holtmann
<marcel@holtmann.org>
Sun, 1 Aug 2010 23:42:13 +0000
(16:42 -0700)
committer
Marcel Holtmann
<marcel@holtmann.org>
Sun, 1 Aug 2010 23:42:13 +0000
(16:42 -0700)
tools/web-test.c
patch
|
blob
|
history
diff --git
a/tools/web-test.c
b/tools/web-test.c
index
cf85c71
..
1d8301f
100644
(file)
--- a/
tools/web-test.c
+++ b/
tools/web-test.c
@@
-44,6
+44,19
@@
static void sig_term(int sig)
g_main_loop_quit(main_loop);
}
g_main_loop_quit(main_loop);
}
+static void web_result(uint16_t status, gpointer user_data)
+{
+ gdouble elapsed;
+
+ elapsed = g_timer_elapsed(timer, NULL);
+
+ g_print("elapse: %f seconds\n", elapsed);
+
+ g_print("status: %03u\n", status);
+
+ g_main_loop_quit(main_loop);
+}
+
static gboolean option_debug = FALSE;
static GOptionEntry options[] = {
static gboolean option_debug = FALSE;
static GOptionEntry options[] = {
@@
-58,6
+71,7
@@
int main(int argc, char *argv[])
GError *error = NULL;
struct sigaction sa;
GWeb *web;
GError *error = NULL;
struct sigaction sa;
GWeb *web;
+ int index = 0;
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
@@
-78,7
+92,7
@@
int main(int argc, char *argv[])
return 1;
}
return 1;
}
- web = g_web_new();
+ web = g_web_new(
index
);
if (web == NULL) {
printf("failed to web service\n");
return 1;
if (web == NULL) {
printf("failed to web service\n");
return 1;
@@
-91,6
+105,12
@@
int main(int argc, char *argv[])
timer = g_timer_new();
timer = g_timer_new();
+ if (g_web_request(web, G_WEB_METHOD_GET, argv[1],
+ web_result, NULL) == 0) {
+ printf("failed to start request\n");
+ return 1;
+ }
+
memset(&sa, 0, sizeof(sa));
sa.sa_handler = sig_term;
sigaction(SIGINT, &sa, NULL);
memset(&sa, 0, sizeof(sa));
sa.sa_handler = sig_term;
sigaction(SIGINT, &sa, NULL);