aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-06-19 21:25:50 +0200
committerChristian Grothoff <christian@grothoff.org>2019-06-19 21:30:25 +0200
commit2111b3716776f2a1e6e6b38888c8dea42907c09d (patch)
tree325c76317c007e2af7533488a31e410518f0ab18
parent9baf882d7642f8aeac734ffd16c8e94bd409a41b (diff)
downloadgnunet-2111b3716776f2a1e6e6b38888c8dea42907c09d.tar.gz
gnunet-2111b3716776f2a1e6e6b38888c8dea42907c09d.zip
fix compiler warnings about unused args
-rw-r--r--src/core/core_api.c5
-rw-r--r--src/core/core_api_monitor_peers.c34
-rw-r--r--src/core/gnunet-core.c80
-rw-r--r--src/nse/gnunet-service-nse.c21
4 files changed, 78 insertions, 62 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 6381d9097..223677a5b 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -341,6 +341,7 @@ core_mq_cancel_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
341{ 341{
342 struct PeerRecord *pr = impl_state; 342 struct PeerRecord *pr = impl_state;
343 343
344 (void) mq;
344 GNUNET_assert (NULL != pr->env); 345 GNUNET_assert (NULL != pr->env);
345 GNUNET_MQ_discard (pr->env); 346 GNUNET_MQ_discard (pr->env);
346 pr->env = NULL; 347 pr->env = NULL;
@@ -359,7 +360,8 @@ static void
359core_mq_error_handler (void *cls, enum GNUNET_MQ_Error error) 360core_mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
360{ 361{
361 /* struct PeerRecord *pr = cls; */ 362 /* struct PeerRecord *pr = cls; */
362 363 (void) cls;
364 (void) error;
363 GNUNET_break_op (0); 365 GNUNET_break_op (0);
364} 366}
365 367
@@ -530,6 +532,7 @@ check_notify_inbound (void *cls, const struct NotifyTrafficMessage *ntm)
530 uint16_t msize; 532 uint16_t msize;
531 const struct GNUNET_MessageHeader *em; 533 const struct GNUNET_MessageHeader *em;
532 534
535 (void) cls;
533 msize = ntohs (ntm->header.size) - sizeof (struct NotifyTrafficMessage); 536 msize = ntohs (ntm->header.size) - sizeof (struct NotifyTrafficMessage);
534 if (msize < sizeof (struct GNUNET_MessageHeader)) 537 if (msize < sizeof (struct GNUNET_MessageHeader))
535 { 538 {
diff --git a/src/core/core_api_monitor_peers.c b/src/core/core_api_monitor_peers.c
index 0ebb94d7b..165f741d2 100644
--- a/src/core/core_api_monitor_peers.c
+++ b/src/core/core_api_monitor_peers.c
@@ -54,7 +54,6 @@ struct GNUNET_CORE_MonitorHandle
54 * Closure for @e peer_cb. 54 * Closure for @e peer_cb.
55 */ 55 */
56 void *peer_cb_cls; 56 void *peer_cb_cls;
57
58}; 57};
59 58
60 59
@@ -77,11 +76,11 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh);
77 * @param error error code 76 * @param error error code
78 */ 77 */
79static void 78static void
80handle_mq_error (void *cls, 79handle_mq_error (void *cls, enum GNUNET_MQ_Error error)
81 enum GNUNET_MQ_Error error)
82{ 80{
83 struct GNUNET_CORE_MonitorHandle *mh = cls; 81 struct GNUNET_CORE_MonitorHandle *mh = cls;
84 82
83 (void) error;
85 reconnect (mh); 84 reconnect (mh);
86} 85}
87 86
@@ -93,8 +92,7 @@ handle_mq_error (void *cls,
93 * @param mon_message monitor message 92 * @param mon_message monitor message
94 */ 93 */
95static void 94static void
96handle_receive_info (void *cls, 95handle_receive_info (void *cls, const struct MonitorNotifyMessage *mon_message)
97 const struct MonitorNotifyMessage *mon_message)
98{ 96{
99 struct GNUNET_CORE_MonitorHandle *mh = cls; 97 struct GNUNET_CORE_MonitorHandle *mh = cls;
100 98
@@ -114,24 +112,20 @@ handle_receive_info (void *cls,
114static void 112static void
115reconnect (struct GNUNET_CORE_MonitorHandle *mh) 113reconnect (struct GNUNET_CORE_MonitorHandle *mh)
116{ 114{
117 struct GNUNET_MQ_MessageHandler handlers[] = { 115 struct GNUNET_MQ_MessageHandler handlers[] =
118 GNUNET_MQ_hd_fixed_size (receive_info, 116 {GNUNET_MQ_hd_fixed_size (receive_info,
119 GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY, 117 GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY,
120 struct MonitorNotifyMessage, 118 struct MonitorNotifyMessage,
121 mh), 119 mh),
122 GNUNET_MQ_handler_end () 120 GNUNET_MQ_handler_end ()};
123 };
124 struct GNUNET_MQ_Envelope *env; 121 struct GNUNET_MQ_Envelope *env;
125 struct GNUNET_MessageHeader *msg; 122 struct GNUNET_MessageHeader *msg;
126 123
127 if (NULL != mh->mq) 124 if (NULL != mh->mq)
128 GNUNET_MQ_destroy (mh->mq); 125 GNUNET_MQ_destroy (mh->mq);
129 /* FIXME: use backoff? */ 126 /* FIXME: use backoff? */
130 mh->mq = GNUNET_CLIENT_connect (mh->cfg, 127 mh->mq =
131 "core", 128 GNUNET_CLIENT_connect (mh->cfg, "core", handlers, &handle_mq_error, mh);
132 handlers,
133 &handle_mq_error,
134 mh);
135 if (NULL == mh->mq) 129 if (NULL == mh->mq)
136 return; 130 return;
137 /* notify callback about reconnect */ 131 /* notify callback about reconnect */
@@ -140,10 +134,8 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh)
140 NULL, 134 NULL,
141 GNUNET_CORE_KX_CORE_DISCONNECT, 135 GNUNET_CORE_KX_CORE_DISCONNECT,
142 GNUNET_TIME_UNIT_FOREVER_ABS); 136 GNUNET_TIME_UNIT_FOREVER_ABS);
143 env = GNUNET_MQ_msg (msg, 137 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS);
144 GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS); 138 GNUNET_MQ_send (mh->mq, env);
145 GNUNET_MQ_send (mh->mq,
146 env);
147} 139}
148 140
149 141
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c
index 7180754a9..674da705a 100644
--- a/src/core/gnunet-core.c
+++ b/src/core/gnunet-core.c
@@ -48,6 +48,7 @@ static struct GNUNET_CORE_MonitorHandle *mh;
48static void 48static void
49shutdown_task (void *cls) 49shutdown_task (void *cls)
50{ 50{
51 (void) cls;
51 if (NULL != mh) 52 if (NULL != mh)
52 { 53 {
53 GNUNET_CORE_monitor_stop (mh); 54 GNUNET_CORE_monitor_stop (mh);
@@ -71,13 +72,13 @@ monitor_cb (void *cls,
71 enum GNUNET_CORE_KxState state, 72 enum GNUNET_CORE_KxState state,
72 struct GNUNET_TIME_Absolute timeout) 73 struct GNUNET_TIME_Absolute timeout)
73{ 74{
74 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get(); 75 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
75 const char *now_str; 76 const char *now_str;
76 const char *state_str; 77 const char *state_str;
77 78
78 if ( ( (NULL == peer) || 79 (void) cls;
79 (GNUNET_CORE_KX_ITERATION_FINISHED == state) ) && 80 if (((NULL == peer) || (GNUNET_CORE_KX_ITERATION_FINISHED == state)) &&
80 (GNUNET_NO == monitor_connections) ) 81 (GNUNET_NO == monitor_connections))
81 { 82 {
82 GNUNET_SCHEDULER_shutdown (); 83 GNUNET_SCHEDULER_shutdown ();
83 return; 84 return;
@@ -87,42 +88,43 @@ monitor_cb (void *cls,
87 { 88 {
88 case GNUNET_CORE_KX_STATE_DOWN: 89 case GNUNET_CORE_KX_STATE_DOWN:
89 /* should never happen, as we immediately send the key */ 90 /* should never happen, as we immediately send the key */
90 state_str = _("fresh connection"); 91 state_str = _ ("fresh connection");
91 break; 92 break;
92 case GNUNET_CORE_KX_STATE_KEY_SENT: 93 case GNUNET_CORE_KX_STATE_KEY_SENT:
93 state_str = _("key sent"); 94 state_str = _ ("key sent");
94 break; 95 break;
95 case GNUNET_CORE_KX_STATE_KEY_RECEIVED: 96 case GNUNET_CORE_KX_STATE_KEY_RECEIVED:
96 state_str = _("key received"); 97 state_str = _ ("key received");
97 break; 98 break;
98 case GNUNET_CORE_KX_STATE_UP: 99 case GNUNET_CORE_KX_STATE_UP:
99 state_str = _("connection established"); 100 state_str = _ ("connection established");
100 break; 101 break;
101 case GNUNET_CORE_KX_STATE_REKEY_SENT: 102 case GNUNET_CORE_KX_STATE_REKEY_SENT:
102 state_str = _("rekeying"); 103 state_str = _ ("rekeying");
103 break; 104 break;
104 case GNUNET_CORE_KX_PEER_DISCONNECT: 105 case GNUNET_CORE_KX_PEER_DISCONNECT:
105 state_str = _("disconnected"); 106 state_str = _ ("disconnected");
106 break; 107 break;
107 case GNUNET_CORE_KX_ITERATION_FINISHED: 108 case GNUNET_CORE_KX_ITERATION_FINISHED:
108 return; 109 return;
109 case GNUNET_CORE_KX_CORE_DISCONNECT: 110 case GNUNET_CORE_KX_CORE_DISCONNECT:
110 FPRINTF (stderr, 111 FPRINTF (stderr,
111 "%s\n", 112 "%s\n",
112 _("Connection to CORE service lost (reconnecting)")); 113 _ ("Connection to CORE service lost (reconnecting)"));
113 return; 114 return;
114 default: 115 default:
115 state_str = _("unknown state"); 116 state_str = _ ("unknown state");
116 break; 117 break;
117 } 118 }
118 now_str = GNUNET_STRINGS_absolute_time_to_string (now); 119 now_str = GNUNET_STRINGS_absolute_time_to_string (now);
119 FPRINTF (stdout, 120 FPRINTF (stdout,
120 _("%24s: %-30s %4s (timeout in %6s)\n"), 121 _ ("%24s: %-30s %4s (timeout in %6s)\n"),
121 now_str, 122 now_str,
122 state_str, 123 state_str,
123 GNUNET_i2s (peer), 124 GNUNET_i2s (peer),
124 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (timeout), 125 GNUNET_STRINGS_relative_time_to_string (
125 GNUNET_YES)); 126 GNUNET_TIME_absolute_get_remaining (timeout),
127 GNUNET_YES));
126} 128}
127 129
128 130
@@ -135,24 +137,22 @@ monitor_cb (void *cls,
135 * @param cfg configuration 137 * @param cfg configuration
136 */ 138 */
137static void 139static void
138run (void *cls, char *const *args, const char *cfgfile, 140run (void *cls,
141 char *const *args,
142 const char *cfgfile,
139 const struct GNUNET_CONFIGURATION_Handle *cfg) 143 const struct GNUNET_CONFIGURATION_Handle *cfg)
140{ 144{
145 (void) cls;
146 (void) cfgfile;
141 if (NULL != args[0]) 147 if (NULL != args[0])
142 { 148 {
143 FPRINTF (stderr, 149 FPRINTF (stderr, _ ("Invalid command line argument `%s'\n"), args[0]);
144 _("Invalid command line argument `%s'\n"),
145 args[0]);
146 return; 150 return;
147 } 151 }
148 mh = GNUNET_CORE_monitor_start (cfg, 152 mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL);
149 &monitor_cb,
150 NULL);
151 if (NULL == mh) 153 if (NULL == mh)
152 { 154 {
153 FPRINTF (stderr, 155 FPRINTF (stderr, "%s", _ ("Failed to connect to CORE service!\n"));
154 "%s",
155 _("Failed to connect to CORE service!\n"));
156 return; 156 return;
157 } 157 }
158 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 158 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
@@ -167,24 +167,28 @@ run (void *cls, char *const *args, const char *cfgfile,
167 * @return 0 ok, 1 on error 167 * @return 0 ok, 1 on error
168 */ 168 */
169int 169int
170main (int argc, 170main (int argc, char *const *argv)
171 char *const *argv)
172{ 171{
173 int res; 172 int res;
174 struct GNUNET_GETOPT_CommandLineOption options[] = { 173 struct GNUNET_GETOPT_CommandLineOption options[] =
175 GNUNET_GETOPT_option_flag ('m', 174 {GNUNET_GETOPT_option_flag (
176 "monitor", 175 'm',
177 gettext_noop ("provide information about all current connections (continuously)"), 176 "monitor",
178 &monitor_connections), 177 gettext_noop (
179 GNUNET_GETOPT_OPTION_END 178 "provide information about all current connections (continuously)"),
180 }; 179 &monitor_connections),
180 GNUNET_GETOPT_OPTION_END};
181 181
182 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 182 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
183 return 2; 183 return 2;
184 res = GNUNET_PROGRAM_run (argc, argv, "gnunet-core", 184 res = GNUNET_PROGRAM_run (argc,
185 gettext_noop 185 argv,
186 ("Print information about connected peers."), 186 "gnunet-core",
187 options, &run, NULL); 187 gettext_noop (
188 "Print information about connected peers."),
189 options,
190 &run,
191 NULL);
188 192
189 GNUNET_free ((void *) argv); 193 GNUNET_free ((void *) argv);
190 if (GNUNET_OK == res) 194 if (GNUNET_OK == res)
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 09316dbcf..fd83d2b67 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -430,6 +430,7 @@ handle_start (void *cls, const struct GNUNET_MessageHeader *message)
430 struct GNUNET_NSE_ClientMessage em; 430 struct GNUNET_NSE_ClientMessage em;
431 struct GNUNET_MQ_Envelope *env; 431 struct GNUNET_MQ_Envelope *env;
432 432
433 (void) message;
433 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); 434 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n");
434 mq = GNUNET_SERVICE_client_get_mq (client); 435 mq = GNUNET_SERVICE_client_get_mq (client);
435 GNUNET_notification_context_add (nc, mq); 436 GNUNET_notification_context_add (nc, mq);
@@ -717,6 +718,8 @@ schedule_current_round (void *cls,
717 struct NSEPeerEntry *peer_entry = value; 718 struct NSEPeerEntry *peer_entry = value;
718 struct GNUNET_TIME_Relative delay; 719 struct GNUNET_TIME_Relative delay;
719 720
721 (void) cls;
722 (void) key;
720 if (NULL != peer_entry->transmit_task) 723 if (NULL != peer_entry->transmit_task)
721 { 724 {
722 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); 725 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
@@ -749,8 +752,8 @@ static void
749update_flood_message (void *cls) 752update_flood_message (void *cls)
750{ 753{
751 struct GNUNET_TIME_Relative offset; 754 struct GNUNET_TIME_Relative offset;
752 unsigned int i;
753 755
756 (void) cls;
754 flood_task = NULL; 757 flood_task = NULL;
755 offset = GNUNET_TIME_absolute_get_remaining (next_timestamp); 758 offset = GNUNET_TIME_absolute_get_remaining (next_timestamp);
756 if (0 != offset.rel_value_us) 759 if (0 != offset.rel_value_us)
@@ -780,7 +783,7 @@ update_flood_message (void *cls)
780 setup_flood_message (estimate_index, current_timestamp); 783 setup_flood_message (estimate_index, current_timestamp);
781 next_message.matching_bits = htonl (0); /* reset for 'next' round */ 784 next_message.matching_bits = htonl (0); /* reset for 'next' round */
782 hop_count_max = 0; 785 hop_count_max = 0;
783 for (i = 0; i < HISTORY_SIZE; i++) 786 for (unsigned int i = 0; i < HISTORY_SIZE; i++)
784 hop_count_max = 787 hop_count_max =
785 GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count), hop_count_max); 788 GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count), hop_count_max);
786 GNUNET_CONTAINER_multipeermap_iterate (peers, &schedule_current_round, NULL); 789 GNUNET_CONTAINER_multipeermap_iterate (peers, &schedule_current_round, NULL);
@@ -869,6 +872,7 @@ find_proof (void *cls)
869 struct GNUNET_HashCode result; 872 struct GNUNET_HashCode result;
870 unsigned int i; 873 unsigned int i;
871 874
875 (void) cls;
872 proof_task = NULL; 876 proof_task = NULL;
873 GNUNET_memcpy (&buf[sizeof (uint64_t)], 877 GNUNET_memcpy (&buf[sizeof (uint64_t)],
874 &my_identity, 878 &my_identity,
@@ -967,6 +971,7 @@ update_flood_times (void *cls,
967 struct NSEPeerEntry *peer_entry = value; 971 struct NSEPeerEntry *peer_entry = value;
968 struct GNUNET_TIME_Relative delay; 972 struct GNUNET_TIME_Relative delay;
969 973
974 (void) key;
970 if (peer_entry == exclude) 975 if (peer_entry == exclude)
971 return GNUNET_OK; /* trigger of the update */ 976 return GNUNET_OK; /* trigger of the update */
972 if (GNUNET_NO == peer_entry->previous_round) 977 if (GNUNET_NO == peer_entry->previous_round)
@@ -1178,6 +1183,7 @@ handle_core_connect (void *cls,
1178{ 1183{
1179 struct NSEPeerEntry *peer_entry; 1184 struct NSEPeerEntry *peer_entry;
1180 1185
1186 (void) cls;
1181 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1182 "Peer `%s' connected to us\n", 1188 "Peer `%s' connected to us\n",
1183 GNUNET_i2s (peer)); 1189 GNUNET_i2s (peer));
@@ -1217,6 +1223,7 @@ handle_core_disconnect (void *cls,
1217{ 1223{
1218 struct NSEPeerEntry *pos = internal_cls; 1224 struct NSEPeerEntry *pos = internal_cls;
1219 1225
1226 (void) cls;
1220 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1227 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1221 "Peer `%s' disconnected from us\n", 1228 "Peer `%s' disconnected from us\n",
1222 GNUNET_i2s (peer)); 1229 GNUNET_i2s (peer));
@@ -1243,6 +1250,8 @@ handle_core_disconnect (void *cls,
1243static void 1250static void
1244flush_comp_cb (void *cls, size_t size) 1251flush_comp_cb (void *cls, size_t size)
1245{ 1252{
1253 (void) cls;
1254 (void) size;
1246 GNUNET_TESTBED_LOGGER_disconnect (lh); 1255 GNUNET_TESTBED_LOGGER_disconnect (lh);
1247 lh = NULL; 1256 lh = NULL;
1248} 1257}
@@ -1257,6 +1266,7 @@ flush_comp_cb (void *cls, size_t size)
1257static void 1266static void
1258shutdown_task (void *cls) 1267shutdown_task (void *cls)
1259{ 1268{
1269 (void) cls;
1260 if (NULL != flood_task) 1270 if (NULL != flood_task)
1261 { 1271 {
1262 GNUNET_SCHEDULER_cancel (flood_task); 1272 GNUNET_SCHEDULER_cancel (flood_task);
@@ -1324,6 +1334,7 @@ core_init (void *cls, const struct GNUNET_PeerIdentity *identity)
1324 struct GNUNET_TIME_Absolute now; 1334 struct GNUNET_TIME_Absolute now;
1325 struct GNUNET_TIME_Absolute prev_time; 1335 struct GNUNET_TIME_Absolute prev_time;
1326 1336
1337 (void) cls;
1327 if (NULL == identity) 1338 if (NULL == identity)
1328 { 1339 {
1329 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n"); 1340 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n");
@@ -1365,6 +1376,7 @@ core_init (void *cls, const struct GNUNET_PeerIdentity *identity)
1365static void 1376static void
1366status_cb (void *cls, int status) 1377status_cb (void *cls, int status)
1367{ 1378{
1379 (void) cls;
1368 logger_test = NULL; 1380 logger_test = NULL;
1369 if (GNUNET_YES != status) 1381 if (GNUNET_YES != status)
1370 { 1382 {
@@ -1402,6 +1414,8 @@ run (void *cls,
1402 char *proof; 1414 char *proof;
1403 struct GNUNET_CRYPTO_EddsaPrivateKey *pk; 1415 struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
1404 1416
1417 (void) cls;
1418 (void) service;
1405 cfg = c; 1419 cfg = c;
1406 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, 1420 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg,
1407 "NSE", 1421 "NSE",
@@ -1524,6 +1538,8 @@ client_connect_cb (void *cls,
1524 struct GNUNET_SERVICE_Client *c, 1538 struct GNUNET_SERVICE_Client *c,
1525 struct GNUNET_MQ_Handle *mq) 1539 struct GNUNET_MQ_Handle *mq)
1526{ 1540{
1541 (void) cls;
1542 (void) mq;
1527 return c; 1543 return c;
1528} 1544}
1529 1545
@@ -1540,6 +1556,7 @@ client_disconnect_cb (void *cls,
1540 struct GNUNET_SERVICE_Client *c, 1556 struct GNUNET_SERVICE_Client *c,
1541 void *internal_cls) 1557 void *internal_cls)
1542{ 1558{
1559 (void) cls;
1543 GNUNET_assert (c == internal_cls); 1560 GNUNET_assert (c == internal_cls);
1544} 1561}
1545 1562