diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/core/gnunet-core.c | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/core/gnunet-core.c')
-rw-r--r-- | src/core/gnunet-core.c | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c index 2ffafc075..0d991f194 100644 --- a/src/core/gnunet-core.c +++ b/src/core/gnunet-core.c | |||
@@ -46,14 +46,14 @@ static struct GNUNET_CORE_MonitorHandle *mh; | |||
46 | * @param cls NULL | 46 | * @param cls NULL |
47 | */ | 47 | */ |
48 | static void | 48 | static void |
49 | shutdown_task(void *cls) | 49 | shutdown_task (void *cls) |
50 | { | 50 | { |
51 | (void)cls; | 51 | (void) cls; |
52 | if (NULL != mh) | 52 | if (NULL != mh) |
53 | { | 53 | { |
54 | GNUNET_CORE_monitor_stop(mh); | 54 | GNUNET_CORE_monitor_stop (mh); |
55 | mh = NULL; | 55 | mh = NULL; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
@@ -67,72 +67,72 @@ shutdown_task(void *cls) | |||
67 | * @param timeout timeout for the new state | 67 | * @param timeout timeout for the new state |
68 | */ | 68 | */ |
69 | static void | 69 | static void |
70 | monitor_cb(void *cls, | 70 | monitor_cb (void *cls, |
71 | const struct GNUNET_PeerIdentity *peer, | 71 | const struct GNUNET_PeerIdentity *peer, |
72 | enum GNUNET_CORE_KxState state, | 72 | enum GNUNET_CORE_KxState state, |
73 | struct GNUNET_TIME_Absolute timeout) | 73 | struct GNUNET_TIME_Absolute timeout) |
74 | { | 74 | { |
75 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get(); | 75 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
76 | const char *now_str; | 76 | const char *now_str; |
77 | const char *state_str; | 77 | const char *state_str; |
78 | 78 | ||
79 | (void)cls; | 79 | (void) cls; |
80 | if (((NULL == peer) || (GNUNET_CORE_KX_ITERATION_FINISHED == state)) && | 80 | if (((NULL == peer) || (GNUNET_CORE_KX_ITERATION_FINISHED == state)) && |
81 | (GNUNET_NO == monitor_connections)) | 81 | (GNUNET_NO == monitor_connections)) |
82 | { | 82 | { |
83 | GNUNET_SCHEDULER_shutdown(); | 83 | GNUNET_SCHEDULER_shutdown (); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | switch (state) | 87 | switch (state) |
88 | { | 88 | { |
89 | case GNUNET_CORE_KX_STATE_DOWN: | 89 | case GNUNET_CORE_KX_STATE_DOWN: |
90 | /* should never happen, as we immediately send the key */ | 90 | /* should never happen, as we immediately send the key */ |
91 | state_str = _("fresh connection"); | 91 | state_str = _ ("fresh connection"); |
92 | break; | 92 | break; |
93 | 93 | ||
94 | case GNUNET_CORE_KX_STATE_KEY_SENT: | 94 | case GNUNET_CORE_KX_STATE_KEY_SENT: |
95 | state_str = _("key sent"); | 95 | state_str = _ ("key sent"); |
96 | break; | 96 | break; |
97 | 97 | ||
98 | case GNUNET_CORE_KX_STATE_KEY_RECEIVED: | 98 | case GNUNET_CORE_KX_STATE_KEY_RECEIVED: |
99 | state_str = _("key received"); | 99 | state_str = _ ("key received"); |
100 | break; | 100 | break; |
101 | 101 | ||
102 | case GNUNET_CORE_KX_STATE_UP: | 102 | case GNUNET_CORE_KX_STATE_UP: |
103 | state_str = _("connection established"); | 103 | state_str = _ ("connection established"); |
104 | break; | 104 | break; |
105 | 105 | ||
106 | case GNUNET_CORE_KX_STATE_REKEY_SENT: | 106 | case GNUNET_CORE_KX_STATE_REKEY_SENT: |
107 | state_str = _("rekeying"); | 107 | state_str = _ ("rekeying"); |
108 | break; | 108 | break; |
109 | 109 | ||
110 | case GNUNET_CORE_KX_PEER_DISCONNECT: | 110 | case GNUNET_CORE_KX_PEER_DISCONNECT: |
111 | state_str = _("disconnected"); | 111 | state_str = _ ("disconnected"); |
112 | break; | 112 | break; |
113 | 113 | ||
114 | case GNUNET_CORE_KX_ITERATION_FINISHED: | 114 | case GNUNET_CORE_KX_ITERATION_FINISHED: |
115 | return; | 115 | return; |
116 | 116 | ||
117 | case GNUNET_CORE_KX_CORE_DISCONNECT: | 117 | case GNUNET_CORE_KX_CORE_DISCONNECT: |
118 | fprintf(stderr, | 118 | fprintf (stderr, |
119 | "%s\n", | 119 | "%s\n", |
120 | _("Connection to CORE service lost (reconnecting)")); | 120 | _ ("Connection to CORE service lost (reconnecting)")); |
121 | return; | 121 | return; |
122 | 122 | ||
123 | default: | 123 | default: |
124 | state_str = _("unknown state"); | 124 | state_str = _ ("unknown state"); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | now_str = GNUNET_STRINGS_absolute_time_to_string(now); | 127 | now_str = GNUNET_STRINGS_absolute_time_to_string (now); |
128 | fprintf(stdout, | 128 | fprintf (stdout, |
129 | _("%24s: %-30s %4s (timeout in %6s)\n"), | 129 | _ ("%24s: %-30s %4s (timeout in %6s)\n"), |
130 | now_str, | 130 | now_str, |
131 | state_str, | 131 | state_str, |
132 | GNUNET_i2s(peer), | 132 | GNUNET_i2s (peer), |
133 | GNUNET_STRINGS_relative_time_to_string( | 133 | GNUNET_STRINGS_relative_time_to_string ( |
134 | GNUNET_TIME_absolute_get_remaining(timeout), | 134 | GNUNET_TIME_absolute_get_remaining (timeout), |
135 | GNUNET_YES)); | 135 | GNUNET_YES)); |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
@@ -145,25 +145,25 @@ monitor_cb(void *cls, | |||
145 | * @param cfg configuration | 145 | * @param cfg configuration |
146 | */ | 146 | */ |
147 | static void | 147 | static void |
148 | run(void *cls, | 148 | run (void *cls, |
149 | char *const *args, | 149 | char *const *args, |
150 | const char *cfgfile, | 150 | const char *cfgfile, |
151 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 151 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
152 | { | 152 | { |
153 | (void)cls; | 153 | (void) cls; |
154 | (void)cfgfile; | 154 | (void) cfgfile; |
155 | if (NULL != args[0]) | 155 | if (NULL != args[0]) |
156 | { | 156 | { |
157 | fprintf(stderr, _("Invalid command line argument `%s'\n"), args[0]); | 157 | fprintf (stderr, _ ("Invalid command line argument `%s'\n"), args[0]); |
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | mh = GNUNET_CORE_monitor_start(cfg, &monitor_cb, NULL); | 160 | mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL); |
161 | if (NULL == mh) | 161 | if (NULL == mh) |
162 | { | 162 | { |
163 | fprintf(stderr, "%s", _("Failed to connect to CORE service!\n")); | 163 | fprintf (stderr, "%s", _ ("Failed to connect to CORE service!\n")); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | GNUNET_SCHEDULER_add_shutdown(&shutdown_task, NULL); | 166 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
167 | } | 167 | } |
168 | 168 | ||
169 | 169 | ||
@@ -175,30 +175,30 @@ run(void *cls, | |||
175 | * @return 0 ok, 1 on error | 175 | * @return 0 ok, 1 on error |
176 | */ | 176 | */ |
177 | int | 177 | int |
178 | main(int argc, char *const *argv) | 178 | main (int argc, char *const *argv) |
179 | { | 179 | { |
180 | int res; | 180 | int res; |
181 | struct GNUNET_GETOPT_CommandLineOption options[] = | 181 | struct GNUNET_GETOPT_CommandLineOption options[] = |
182 | { GNUNET_GETOPT_option_flag( | 182 | { GNUNET_GETOPT_option_flag ( |
183 | 'm', | 183 | 'm', |
184 | "monitor", | 184 | "monitor", |
185 | gettext_noop( | 185 | gettext_noop ( |
186 | "provide information about all current connections (continuously)"), | 186 | "provide information about all current connections (continuously)"), |
187 | &monitor_connections), | 187 | &monitor_connections), |
188 | GNUNET_GETOPT_OPTION_END }; | 188 | GNUNET_GETOPT_OPTION_END }; |
189 | 189 | ||
190 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv)) | 190 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
191 | return 2; | 191 | return 2; |
192 | res = GNUNET_PROGRAM_run(argc, | 192 | res = GNUNET_PROGRAM_run (argc, |
193 | argv, | 193 | argv, |
194 | "gnunet-core", | 194 | "gnunet-core", |
195 | gettext_noop( | 195 | gettext_noop ( |
196 | "Print information about connected peers."), | 196 | "Print information about connected peers."), |
197 | options, | 197 | options, |
198 | &run, | 198 | &run, |
199 | NULL); | 199 | NULL); |
200 | 200 | ||
201 | GNUNET_free((void *)argv); | 201 | GNUNET_free ((void *) argv); |
202 | if (GNUNET_OK == res) | 202 | if (GNUNET_OK == res) |
203 | return 0; | 203 | return 0; |
204 | return 1; | 204 | return 1; |