From 7e3cf5f461eb4fbb7581672bf0835da07c378136 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 31 Oct 2019 13:03:48 +0100 Subject: tighten formatting rules --- src/cadet/cadet_api.c | 1 + src/cadet/cadet_api_get_channel.c | 1 + src/cadet/cadet_api_list_peers.c | 1 + src/cadet/cadet_test_lib.c | 1 + src/cadet/gnunet-cadet-profiler.c | 11 ++++++--- src/cadet/gnunet-cadet.c | 4 +++- src/cadet/gnunet-service-cadet.c | 4 +--- src/cadet/gnunet-service-cadet_channel.c | 6 ++--- src/cadet/gnunet-service-cadet_channel.h | 1 - src/cadet/gnunet-service-cadet_connection.c | 1 + src/cadet/gnunet-service-cadet_core.c | 1 + src/cadet/gnunet-service-cadet_dht.c | 1 + src/cadet/gnunet-service-cadet_hello.c | 1 + src/cadet/gnunet-service-cadet_paths.c | 1 - src/cadet/gnunet-service-cadet_peer.c | 3 +-- src/cadet/gnunet-service-cadet_tunnels.c | 8 +++---- src/cadet/test_cadet.c | 37 ++++++++++++++--------------- src/cadet/test_cadet_flow.c | 15 ++++++------ src/cadet/test_cadet_local_mq.c | 3 +++ 19 files changed, 55 insertions(+), 46 deletions(-) (limited to 'src/cadet') diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 9aeedb616..68bd4c290 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -1121,4 +1121,5 @@ GNUNET_CADET_get_mq (const struct GNUNET_CADET_Channel *channel) return channel->mq; } + /* end of cadet_api.c */ diff --git a/src/cadet/cadet_api_get_channel.c b/src/cadet/cadet_api_get_channel.c index 6d86e8e81..05e2a8383 100644 --- a/src/cadet/cadet_api_get_channel.c +++ b/src/cadet/cadet_api_get_channel.c @@ -256,4 +256,5 @@ GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm) return ret; } + /* end of cadet_api_get_channel.c */ diff --git a/src/cadet/cadet_api_list_peers.c b/src/cadet/cadet_api_list_peers.c index 8865b6f57..52f59cc74 100644 --- a/src/cadet/cadet_api_list_peers.c +++ b/src/cadet/cadet_api_list_peers.c @@ -234,4 +234,5 @@ GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_PeersLister *pl) return ret; } + /* end of cadet_api_list_peers.c */ diff --git a/src/cadet/cadet_test_lib.c b/src/cadet/cadet_test_lib.c index 490e6539b..9c7b9063d 100644 --- a/src/cadet/cadet_test_lib.c +++ b/src/cadet/cadet_test_lib.c @@ -372,4 +372,5 @@ GNUNET_CADET_TEST_ruN (const char *testname, ctx); } + /* end of cadet_test_lib.c */ diff --git a/src/cadet/gnunet-cadet-profiler.c b/src/cadet/gnunet-cadet-profiler.c index e66761e1e..c3a19a399 100644 --- a/src/cadet/gnunet-cadet-profiler.c +++ b/src/cadet/gnunet-cadet-profiler.c @@ -407,6 +407,7 @@ abort_test (long line) } } + /** * Stats callback. Finish the stats testbed operation and when all stats have * been iterated, shutdown the test. @@ -615,7 +616,7 @@ tmt_rdy_pong (void *cls, size_t size, void *buf) struct CadetPingMessage *ping = cls; struct CadetPingMessage *pong; - if ((0 == size)||(NULL == buf)) + if ((0 == size) || (NULL == buf)) { GNUNET_free (ping); return 0; @@ -654,6 +655,7 @@ ping (void *cls) &tmt_rdy_ping, peer); } + /** * @brief Reply with a pong to origin. * @@ -691,7 +693,7 @@ tmt_rdy_ping (void *cls, size_t size, void *buf) peer->ping_ntr = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy called, filling buffer\n"); - if ((size < sizeof(struct CadetPingMessage))||(NULL == buf)) + if ((size < sizeof(struct CadetPingMessage)) || (NULL == buf)) { GNUNET_break (GNUNET_YES == test_finished); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -857,6 +859,7 @@ incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel, return NULL; } + /** * Function called whenever an inbound channel is destroyed. Should clean up * any associated state. @@ -903,6 +906,7 @@ select_random_peer (struct CadetPeer *peer) return &peers[r]; } + /** * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES. * @@ -999,7 +1003,7 @@ peer_id_cb (void *cls, { long n = (long) cls; - if ((NULL == pinfo)||(NULL != emsg)) + if ((NULL == pinfo) || (NULL != emsg)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "pi_cb: %s\n", emsg); abort_test (__LINE__); @@ -1151,4 +1155,5 @@ main (int argc, char *argv[]) return 0; } + /* end of gnunet-cadet-profiler.c */ diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index d85a3c6ba..f3ccd9883 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c @@ -265,6 +265,7 @@ shutdown_task (void *cls) } } + void mq_cb (void *cls) { @@ -676,7 +677,7 @@ run (void *cls, if (target_id && args[1]) target_port = args[1]; - if (((0 != (request_peers | request_tunnels))||(NULL != conn_id)|| + if (((0 != (request_peers | request_tunnels)) || (NULL != conn_id) || (NULL != channel_id) ) && (target_id != NULL) ) { @@ -846,4 +847,5 @@ main (int argc, char *const *argv) return 1; } + /* end of gnunet-cadet.c */ diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index c64da33e2..ba83fe0fc 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c @@ -688,9 +688,7 @@ check_local_data (void *cls, ONE payload item or multiple? Seems current cadet_api at least in theory allows more than one. Next-gen cadet_api will likely no more, so we could then - simplify this mess again. */ - /* Sanity check for message size */ - payload_size = ntohs (msg->header.size) - sizeof(*msg); + simplify this mess again. *//* Sanity check for message size */payload_size = ntohs (msg->header.size) - sizeof(*msg); buf = (const char *) &msg[1]; while (payload_size >= sizeof(struct GNUNET_MessageHeader)) { diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 0a261039c..a2c710cbc 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -1238,8 +1238,7 @@ GCCH_handle_channel_plaintext_data ( * - The channel is out-of-order * - The channel is reliable and MID matches next expected MID * - The channel is unreliable and MID is before lowest seen MID - */ - if ((GNUNET_YES == ch->out_of_order) || + */if ((GNUNET_YES == ch->out_of_order) || ((msg->mid.mid == ch->mid_recv.mid) && (GNUNET_YES == ch->reliable)) || ((GNUNET_NO == ch->reliable) && (ntohl (msg->mid.mid) >= ntohl (ch->mid_recv.mid)) && @@ -1415,8 +1414,7 @@ GCCH_handle_channel_plaintext_data ( the case above if "delta" >= 64, which could be the case if max_pending_messages is also >= 64 or if our client is unready and we are seeing retransmissions of the message our client is - blocked on. */ - LOG (GNUNET_ERROR_TYPE_DEBUG, + blocked on. */LOG (GNUNET_ERROR_TYPE_DEBUG, "Duplicate payload of %u bytes on %s (mid %u) dropped\n", (unsigned int) payload_size, GCCH_2s (ch), diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h index 181c6e88b..0a6c97329 100644 --- a/src/cadet/gnunet-service-cadet_channel.h +++ b/src/cadet/gnunet-service-cadet_channel.h @@ -183,7 +183,6 @@ GCCH_handle_duplicate_open (struct CadetChannel *ch, GNUNET_CADET_ConnectionTunnelIdentifier *cti); - /** * We got payload data for a channel. Pass it on to the client. * diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 66dc20481..c07339ebc 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -1053,4 +1053,5 @@ GCC_debug (struct CadetConnection *cc, enum GNUNET_ErrorType level) #endif } + /* end of gnunet-service-cadet_connection.c */ diff --git a/src/cadet/gnunet-service-cadet_core.c b/src/cadet/gnunet-service-cadet_core.c index 7d1791f3c..d54022896 100644 --- a/src/cadet/gnunet-service-cadet_core.c +++ b/src/cadet/gnunet-service-cadet_core.c @@ -1333,4 +1333,5 @@ GCO_shutdown () } } + /* end of gnunet-cadet-service_core.c */ diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c index 3bb86cae4..4e8ccbb08 100644 --- a/src/cadet/gnunet-service-cadet_dht.c +++ b/src/cadet/gnunet-service-cadet_dht.c @@ -349,4 +349,5 @@ GCD_search_stop (struct GCD_search_handle *h) GNUNET_free (h); } + /* end of gnunet-service-cadet_dht.c */ diff --git a/src/cadet/gnunet-service-cadet_hello.c b/src/cadet/gnunet-service-cadet_hello.c index bbe947ad1..21870a454 100644 --- a/src/cadet/gnunet-service-cadet_hello.c +++ b/src/cadet/gnunet-service-cadet_hello.c @@ -146,4 +146,5 @@ GCH_get_mine (void) return mine; } + /* end of gnunet-service-cadet-new_hello.c */ diff --git a/src/cadet/gnunet-service-cadet_paths.c b/src/cadet/gnunet-service-cadet_paths.c index e4a8dc789..087515a5e 100644 --- a/src/cadet/gnunet-service-cadet_paths.c +++ b/src/cadet/gnunet-service-cadet_paths.c @@ -156,7 +156,6 @@ GCPP_add_connection (struct CadetPeerPath *path, } - /** * Notify @a path that it is no longer used for connection @a cc which * ended at the path's offset @a off. diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 52a0c2bd3..8258881d0 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c @@ -1250,6 +1250,7 @@ GCP_iterate_paths (struct CadetPeer *cp, return ret; } + /** * Iterate over the paths to a peer without direct link. * @@ -1552,6 +1553,4 @@ GCP_send_ooo (struct CadetPeer *cp, } - - /* end of gnunet-service-cadet-new_peer.c */ diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c index 6f2dd1d8d..d7c7f278e 100644 --- a/src/cadet/gnunet-service-cadet_tunnels.c +++ b/src/cadet/gnunet-service-cadet_tunnels.c @@ -1922,6 +1922,7 @@ test_crypto_bug (const struct GNUNET_CRYPTO_EcdhePrivateKey *e1, check_ed (e2, d1); } + #endif @@ -2064,7 +2065,6 @@ GCT_handle_kx_auth (struct CadetTConnection *ct, } - /* ************************************** end core crypto ***************************** */ @@ -2828,8 +2828,7 @@ maintain_connections_cb (void *cls) restarted after that happens). Furthermore, if the paths we do know are in a reasonably narrow quality band and are plentyful, we might also consider us stabilized - and then reduce the frequency accordingly. */ - delay = GNUNET_TIME_UNIT_MINUTES; + and then reduce the frequency accordingly. */delay = GNUNET_TIME_UNIT_MINUTES; t->maintain_connections_task = GNUNET_SCHEDULER_add_delayed (delay, &maintain_connections_cb, @@ -3398,8 +3397,7 @@ GCT_handle_encrypted (struct CadetTConnection *ct, this increment if we successfully decrypted with the old KX material and thus didn't even both with the new one. This is the ideal case, as a malicious injection of bogus KX data - basically only causes us to increment a counter a few times. */ - t->unverified_attempts++; + basically only causes us to increment a counter a few times. */t->unverified_attempts++; LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to decrypt message with unverified KX data %u times\n", t->unverified_attempts); diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index 354593c4b..25713709c 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c @@ -263,7 +263,7 @@ static unsigned int msg_dropped; static struct GNUNET_CADET_Channel * get_target_channel () { - if ((SPEED == test)&&(GNUNET_YES == test_backwards)) + if ((SPEED == test) && (GNUNET_YES == test_backwards)) return outgoing_ch; else return incoming_ch; @@ -383,7 +383,7 @@ stats_cont (void *cls, "KA sent: %u, KA received: %u\n", ka_sent, ka_received); - if (((KEEPALIVE == test)||(REOPEN == test)) && + if (((KEEPALIVE == test) || (REOPEN == test)) && ((ka_sent < 2) || (ka_sent > ka_received + 1))) { GNUNET_break (0); @@ -426,10 +426,10 @@ stats_iterator (void *cls, i = GNUNET_TESTBED_get_index (peer); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "STATS PEER %u - %s [%s]: %llu\n", i, subsystem, name, (unsigned long long) value); - if ((0 == strncmp (s_sent, name, strlen (s_sent)))&&(0 == i)) + if ((0 == strncmp (s_sent, name, strlen (s_sent))) && (0 == i)) ka_sent = value; - if ((0 == strncmp (s_recv, name, strlen (s_recv)))&&(peers_requested - 1 == - i) ) + if ((0 == strncmp (s_recv, name, strlen (s_recv))) && (peers_requested - 1 == + i) ) ka_received = value; if (0 == strncmp (rdrops, name, strlen (rdrops))) msg_dropped += value; @@ -556,6 +556,7 @@ reconnect_op (void *cls) send_test_message (outgoing_ch); } + /** * Function called whenever an MQ-channel is destroyed, unless the destruction * was requested by #GNUNET_CADET_channel_destroy. @@ -594,14 +595,14 @@ disconnect_handler (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unknown channel! %p\n", channel); - if ((NULL != disconnect_task)&&(REOPEN != test)) + if ((NULL != disconnect_task) && (REOPEN != test)) { GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_now (&gather_stats_and_exit, (void *) __LINE__); } - else if ((NULL != reconnect_task)&&(REOPEN == test)) + else if ((NULL != reconnect_task) && (REOPEN == test)) { GNUNET_SCHEDULER_cancel (reconnect_task); reconnect_task = @@ -661,7 +662,7 @@ send_test_message (struct GNUNET_CADET_Channel *channel) if (SPEED_ACK == test) // FIXME unify SPEED_ACK with an initializer data_sent++; } - else if ((SPEED == test)||(SPEED_ACK == test)) + else if ((SPEED == test) || (SPEED_ACK == test)) { if (get_target_channel () == channel) { @@ -860,7 +861,7 @@ handle_data (void *cls, if (get_target_channel () == channel) /* Got "data" */ { GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received); - if ((SPEED != test) ||( (ok_goal - 2) == ok) ) + if ((SPEED != test) || ( (ok_goal - 2) == ok) ) { /* Send ACK */ send_test_message (channel); @@ -874,14 +875,14 @@ handle_data (void *cls, } else /* Got "ack" */ { - if ((SPEED_ACK == test) ||(SPEED == test) ) + if ((SPEED_ACK == test) || (SPEED == test) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", ack_received); /* Send more data */ send_test_message (channel); - if ((ack_received < total_packets) &&(SPEED != test) ) + if ((ack_received < total_packets) && (SPEED != test) ) return; - if ((ok == 2) &&(SPEED == test) ) + if ((ok == 2) && (SPEED == test) ) return; show_end_data (); } @@ -946,7 +947,7 @@ connect_handler (void *cls, (long) cls); GNUNET_assert (0); } - if ((NULL != disconnect_task)&&(REOPEN != test)) + if ((NULL != disconnect_task) && (REOPEN != test)) { GNUNET_SCHEDULER_cancel (disconnect_task); disconnect_task = GNUNET_SCHEDULER_add_delayed (short_time, @@ -1223,8 +1224,7 @@ main (int argc, char *argv[]) * total_packets received data packet (@dest) * total_packets received data packet (@orig) * 1 received channel destroy (@dest) FIXME #5818 - */ - ok_goal = total_packets * 2 + 2; + */ok_goal = total_packets * 2 + 2; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED_ACK\n"); test = SPEED_ACK; test_name = "speed ack"; @@ -1237,8 +1237,7 @@ main (int argc, char *argv[]) * total_packets received data packet (@dest) * 1 received data packet (@orig) * 1 received channel destroy (@dest) FIXME #5818 - */ - ok_goal = total_packets + 4; + */ok_goal = total_packets + 4; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED\n"); if (strstr (argv[0], "_reliable") != NULL) { @@ -1260,8 +1259,7 @@ main (int argc, char *argv[]) * 1 incoming channel (@dest) * [wait] * 1 received channel destroy (@dest) FIXME #5818 - */ - ok_goal = 1; + */ok_goal = 1; } else if (strstr (argv[0], "_reopen") != NULL) { @@ -1313,4 +1311,5 @@ main (int argc, char *argv[]) return 0; } + /* end of test_cadet.c */ diff --git a/src/cadet/test_cadet_flow.c b/src/cadet/test_cadet_flow.c index 94e1f1c85..2fbdd8d50 100644 --- a/src/cadet/test_cadet_flow.c +++ b/src/cadet/test_cadet_flow.c @@ -333,10 +333,10 @@ stats_iterator (void *cls, i = GNUNET_TESTBED_get_index (peer); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "STATS PEER %u - %s [%s]: %llu\n", i, subsystem, name, (unsigned long long) value); - if ((0 == strncmp (s_sent, name, strlen (s_sent)))&&(0 == i)) + if ((0 == strncmp (s_sent, name, strlen (s_sent))) && (0 == i)) ka_sent = value; - if ((0 == strncmp (s_recv, name, strlen (s_recv)))&&(peers_requested - 1 == - i) ) + if ((0 == strncmp (s_recv, name, strlen (s_recv))) && (peers_requested - 1 == + i) ) ka_received = value; if (0 == strncmp (rdrops, name, strlen (rdrops))) msg_dropped += value; @@ -425,7 +425,7 @@ send_test_message (struct GNUNET_CADET_Channel *channel) if (SPEED_ACK == test) // FIXME unify SPEED_ACK with an initializer data_sent++; } - else if ((SPEED == test)||(SPEED_ACK == test)) + else if ((SPEED == test) || (SPEED_ACK == test)) { if (get_target_channel () == channel) { @@ -577,14 +577,14 @@ handle_data (void *cls, } else /* Got "ack" */ { - if ((SPEED_ACK == test) ||(SPEED == test) ) + if ((SPEED_ACK == test) || (SPEED == test) ) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", ack_received); /* Send more data */ send_test_message (channel); - if ((ack_received < total_packets) &&(SPEED != test) ) + if ((ack_received < total_packets) && (SPEED != test) ) return; - if ((ok == 2) &&(SPEED == test) ) + if ((ok == 2) && (SPEED == test) ) return; show_end_data (); } @@ -887,4 +887,5 @@ main (int argc, return 0; } + /* end of test_cadet_flow.c */ diff --git a/src/cadet/test_cadet_local_mq.c b/src/cadet/test_cadet_local_mq.c index c56b510ae..6f75dfd1f 100644 --- a/src/cadet/test_cadet_local_mq.c +++ b/src/cadet/test_cadet_local_mq.c @@ -131,6 +131,7 @@ do_abort (void *cls) GNUNET_SCHEDULER_shutdown (); } + /** * Method called whenever a peer connects to a port in MQ-based CADET. * @@ -155,6 +156,7 @@ connected (void *cls, return channel; } + /** * Function called whenever an MQ-channel is destroyed, even if the destruction * was requested by #GNUNET_CADET_channel_destroy. @@ -332,4 +334,5 @@ main (int argc, char *argv[]) return (result == GNUNET_OK) ? 0 : 1; } + /* end of test_cadet_local_1.c */ -- cgit v1.2.3