]>
Commit | Line | Data |
---|---|---|
2056dd30 AM |
1 | From 66b400ab01b8133e450bb002e175117a1ab6f9ae Mon Sep 17 00:00:00 2001 |
2 | From: Jeremy Katz <jeremy@katzbox.net> | |
3 | Date: Sun, 26 Jan 2014 20:43:19 -0500 | |
4 | Subject: [PATCH 09/22] Call curl_global_init() in _init of plugins using curl | |
5 | ||
6 | Need to call curl_global_init() or curl_easy_init() during init | |
7 | for plugins when we're still running single threaded. This | |
8 | updates the remaining ones | |
9 | --- | |
10 | src/curl.c | 1 + | |
11 | src/curl_json.c | 9 +++++++++ | |
12 | src/curl_xml.c | 9 +++++++++ | |
13 | src/write_http.c | 9 +++++++++ | |
14 | 4 files changed, 28 insertions(+) | |
15 | ||
16 | diff --git a/src/curl.c b/src/curl.c | |
17 | index 3899aaa..8d2893f 100644 | |
18 | --- a/src/curl.c | |
19 | +++ b/src/curl.c | |
20 | @@ -566,6 +566,7 @@ static int cc_init (void) /* {{{ */ | |
21 | INFO ("curl plugin: No pages have been defined."); | |
22 | return (-1); | |
23 | } | |
24 | + curl_global_init (CURL_GLOBAL_SSL); | |
25 | return (0); | |
26 | } /* }}} int cc_init */ | |
27 | ||
28 | diff --git a/src/curl_json.c b/src/curl_json.c | |
29 | index 24e1df1..0948962 100644 | |
30 | --- a/src/curl_json.c | |
31 | +++ b/src/curl_json.c | |
32 | @@ -882,9 +882,18 @@ static int cj_read (user_data_t *ud) /* {{{ */ | |
33 | return cj_curl_perform (db, db->curl); | |
34 | } /* }}} int cj_read */ | |
35 | ||
36 | +static int cj_init (void) /* {{{ */ | |
37 | +{ | |
38 | + /* Call this while collectd is still single-threaded to avoid | |
39 | + * initialization issues in libgcrypt. */ | |
40 | + curl_global_init (CURL_GLOBAL_SSL); | |
41 | + return (0); | |
42 | +} /* }}} int cj_init */ | |
43 | + | |
44 | void module_register (void) | |
45 | { | |
46 | plugin_register_complex_config ("curl_json", cj_config); | |
47 | + plugin_register_init ("curl_json", cj_init); | |
48 | } /* void module_register */ | |
49 | ||
50 | /* vim: set sw=2 sts=2 et fdm=marker : */ | |
51 | diff --git a/src/curl_xml.c b/src/curl_xml.c | |
52 | index b941f02..e31e73d 100644 | |
53 | --- a/src/curl_xml.c | |
54 | +++ b/src/curl_xml.c | |
55 | @@ -926,9 +926,18 @@ static int cx_config (oconfig_item_t *ci) /* {{{ */ | |
56 | return (0); | |
57 | } /* }}} int cx_config */ | |
58 | ||
59 | +static int cx_init (void) /* {{{ */ | |
60 | +{ | |
61 | + /* Call this while collectd is still single-threaded to avoid | |
62 | + * initialization issues in libgcrypt. */ | |
63 | + curl_global_init (CURL_GLOBAL_SSL); | |
64 | + return (0); | |
65 | +} /* }}} int cx_init */ | |
66 | + | |
67 | void module_register (void) | |
68 | { | |
69 | plugin_register_complex_config ("curl_xml", cx_config); | |
70 | + plugin_register_init ("curl_xml", cx_init); | |
71 | } /* void module_register */ | |
72 | ||
73 | /* vim: set sw=2 sts=2 et fdm=marker : */ | |
74 | diff --git a/src/write_http.c b/src/write_http.c | |
75 | index 62c73b0..04c637b 100644 | |
76 | --- a/src/write_http.c | |
77 | +++ b/src/write_http.c | |
78 | @@ -656,9 +656,18 @@ static int wh_config (oconfig_item_t *ci) /* {{{ */ | |
79 | return (0); | |
80 | } /* }}} int wh_config */ | |
81 | ||
82 | +static int wh_init (void) /* {{{ */ | |
83 | +{ | |
84 | + /* Call this while collectd is still single-threaded to avoid | |
85 | + * initialization issues in libgcrypt. */ | |
86 | + curl_global_init (CURL_GLOBAL_SSL); | |
87 | + return (0); | |
88 | +} /* }}} int wh_init */ | |
89 | + | |
90 | void module_register (void) /* {{{ */ | |
91 | { | |
92 | plugin_register_complex_config ("write_http", wh_config); | |
93 | + plugin_register_init ("write_http", wh_init); | |
94 | } /* }}} void module_register */ | |
95 | ||
96 | /* vim: set fdm=marker sw=8 ts=8 tw=78 et : */ | |
97 | -- | |
98 | 1.9.3 | |
99 |