summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-18 00:44:39 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-18 00:44:39 +0200
commit7f4ddbcab8598e3d5e29c23ce883cdfa664408f1 (patch)
tree5f1b18463f641f24fad519e0aefb60b97d707b52 /src/transport
parent28ab2c446fba4980a8295d59fdf203a028a35dd6 (diff)
merge flags into enum for GNUNET_DISK_pipe() API, fixing #6188
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-communicator-tcp.c19
-rw-r--r--src/transport/gnunet-communicator-udp.c3
-rw-r--r--src/transport/gnunet-communicator-unix.c5
-rw-r--r--src/transport/plugin_transport_smtp.c6
-rw-r--r--src/transport/test_communicator_basic.c54
-rw-r--r--src/transport/transport-testing2.c28
-rw-r--r--src/transport/transport.h1
-rw-r--r--src/transport/transport_api2_communication.c3
8 files changed, 68 insertions, 51 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index e25cdf139..177b5c26c 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -577,7 +577,6 @@ struct Addresses
};
-
/**
* Maximum queue length before we stop reading towards the transport service.
*/
@@ -1203,6 +1202,7 @@ queue_read (void *cls)
queue_finish (queue);
}
+
/**
* Convert a `struct sockaddr_in6 to a `struct sockaddr *`
*
@@ -1234,6 +1234,7 @@ tcp_address_to_sockaddr_numeric_v6 (socklen_t *sock_len, struct sockaddr_in6 v6,
return in;
}
+
/**
* Convert a `struct sockaddr_in4 to a `struct sockaddr *`
*
@@ -1257,6 +1258,7 @@ tcp_address_to_sockaddr_numeric_v4 (socklen_t *sock_len, struct sockaddr_in v4,
return in;
}
+
/**
* Convert TCP bind specification to a `struct PortOnlyIpv4Ipv6 *`
*
@@ -1318,6 +1320,7 @@ tcp_address_to_sockaddr_port_only (const char *bindto, unsigned int *port)
return po;
}
+
/**
* This Method extracts the address part of the BINDTO string.
*
@@ -1344,7 +1347,8 @@ extract_address (const char *bindto)
start++; /* skip over '['*/
cp[strlen (cp) - 1] = '\0'; /* eat ']'*/
}
- else {
+ else
+ {
token = strtok_r (cp, "]", &rest);
if (strlen (bindto) == strlen (token))
{
@@ -1362,6 +1366,7 @@ extract_address (const char *bindto)
return start;
}
+
/**
* This Method extracts the port part of the BINDTO string.
*
@@ -1440,6 +1445,7 @@ extract_port (const char *addr_and_port)
return port;
}
+
/**
* Convert TCP bind specification to a `struct sockaddr *`
*
@@ -2140,6 +2146,7 @@ queue_read_kx (void *cls)
queue->read_task = GNUNET_SCHEDULER_add_now (&queue_read, queue);
}
+
/**
* Function called by the transport service to initialize a
* message queue given address information about another peer.
@@ -2229,6 +2236,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
return GNUNET_OK;
}
+
/**
* Iterator over all message queues to clean up.
*
@@ -2367,6 +2375,7 @@ nat_address_cb (void *cls,
}
}
+
/**
* This method launch network interactions for each address we like to bind to.
*
@@ -2474,7 +2483,7 @@ init_socket (const struct sockaddr *addr,
if (NULL == queue_map)
queue_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
- if (NULL == ch )
+ if (NULL == ch)
ch = GNUNET_TRANSPORT_communicator_connect (cfg,
COMMUNICATOR_CONFIG_SECTION,
COMMUNICATOR_ADDRESS_PREFIX,
@@ -2496,6 +2505,7 @@ init_socket (const struct sockaddr *addr,
}
+
/**
* This method reads from the DLL addrs_head to register them at the NAT service.
*/
@@ -2557,6 +2567,7 @@ nat_register ()
}
}
+
/**
* This method adds addresses to the DLL, that are later register at the NAT service.
*/
@@ -2573,6 +2584,7 @@ add_addr (struct sockaddr *in, socklen_t in_len)
addrs_lens++;
}
+
/**
* This method is the callback called by the resolver API, and wraps method init_socket.
*
@@ -2625,6 +2637,7 @@ init_socket_resolv (void *cls,
}
}
+
/**
* Setup communicator and launch network interactions.
*
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index efbbd08a7..03c120cc9 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1309,7 +1309,8 @@ handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
"Tell transport we have more acks!\n");
GNUNET_TRANSPORT_communicator_mq_update (ch,
receiver->d_qh,
- (allowed - ss->sequence_allowed),
+ (allowed
+ - ss->sequence_allowed),
1);
ss->sequence_allowed = allowed;
/* move ss to head to avoid discarding it anytime soon! */
diff --git a/src/transport/gnunet-communicator-unix.c b/src/transport/gnunet-communicator-unix.c
index 6ea0ea360..d7e18f87a 100644
--- a/src/transport/gnunet-communicator-unix.c
+++ b/src/transport/gnunet-communicator-unix.c
@@ -673,7 +673,8 @@ setup_queue (const struct GNUNET_PeerIdentity *target,
queue->qh = GNUNET_TRANSPORT_communicator_mq_add (ch,
&queue->target,
foreign_addr,
- UNIX_MTU - sizeof (struct UNIXMessage),
+ UNIX_MTU - sizeof (struct
+ UNIXMessage),
GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED,
0,
GNUNET_NT_LOOPBACK,
@@ -799,7 +800,7 @@ select_read_cb (void *cls)
/* ensure aligned access */
memcpy (&al_hdr, currhdr, sizeof(al_hdr));
if ((tsize < sizeof(struct GNUNET_MessageHeader)) ||
- (tsize != ntohs(al_hdr.size)))
+ (tsize != ntohs (al_hdr.size)))
{
GNUNET_break_op (0);
return;
diff --git a/src/transport/plugin_transport_smtp.c b/src/transport/plugin_transport_smtp.c
index 330023118..f3db4fc5a 100644
--- a/src/transport/plugin_transport_smtp.c
+++ b/src/transport/plugin_transport_smtp.c
@@ -174,9 +174,9 @@ listenAndDistribute (void *unused)
goto END; \
} \
if (core_api->load_monitor != NULL) \
- GNUNET_network_monitor_notify_transmission (core_api->load_monitor, \
- GNUNET_ND_DOWNLOAD, \
- strlen (retl)); \
+ GNUNET_network_monitor_notify_transmission (core_api->load_monitor, \
+ GNUNET_ND_DOWNLOAD, \
+ strlen (retl)); \
} while (0)
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index 290167960..45c268684 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -224,8 +224,8 @@ latency_timeout (void *cls)
}
LOG (GNUNET_ERROR_TYPE_ERROR,
- "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n",
- phase, num_sent, num_received);
+ "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n",
+ phase, num_sent, num_received);
ret = 2;
GNUNET_SCHEDULER_shutdown ();
}
@@ -403,7 +403,7 @@ incoming_message_cb (void *cls,
if (0 != strcmp ((char*) cls, cfg_peers_name[NUM_PEERS - 1]))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- "unexpected receiver...\n");
+ "unexpected receiver...\n");
return;
}
/* Reset timeout */
@@ -422,18 +422,18 @@ incoming_message_cb (void *cls,
if (num_received == BURST_PACKETS)
{
LOG (GNUNET_ERROR_TYPE_MESSAGE,
- "Short size packet test done.\n");
+ "Short size packet test done.\n");
char *goodput = GNUNET_STRINGS_byte_size_fancy ((SHORT_MESSAGE_SIZE
* num_received * 1000
* 1000)
/ duration.rel_value_us);
LOG (GNUNET_ERROR_TYPE_MESSAGE,
- "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n",
- (unsigned long) num_received,
- (unsigned long) num_sent,
- (unsigned long long) duration.rel_value_us,
- goodput,
- (unsigned long long) avg_latency);
+ "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n",
+ (unsigned long) num_received,
+ (unsigned long) num_sent,
+ (unsigned long long) duration.rel_value_us,
+ goodput,
+ (unsigned long long) avg_latency);
GNUNET_free (goodput);
start_long = GNUNET_TIME_absolute_get ();
phase = TP_BURST_LONG;
@@ -449,7 +449,7 @@ incoming_message_cb (void *cls,
if (long_message_size != payload_len)
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- "Ignoring packet with wrong length\n");
+ "Ignoring packet with wrong length\n");
return; // Ignore
}
num_received++;
@@ -458,19 +458,19 @@ incoming_message_cb (void *cls,
if (num_received == BURST_PACKETS)
{
LOG (GNUNET_ERROR_TYPE_MESSAGE,
- "Long size packet test done.\n");
+ "Long size packet test done.\n");
char *goodput = GNUNET_STRINGS_byte_size_fancy ((long_message_size
* num_received * 1000
* 1000)
/ duration.rel_value_us);
LOG (GNUNET_ERROR_TYPE_MESSAGE,
- "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n",
- (unsigned long) num_received,
- (unsigned long) num_sent,
- (unsigned long long) duration.rel_value_us,
- goodput,
- (unsigned long long) avg_latency);
+ "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n",
+ (unsigned long) num_received,
+ (unsigned long) num_sent,
+ (unsigned long long) duration.rel_value_us,
+ goodput,
+ (unsigned long long) avg_latency);
GNUNET_free (goodput);
ack = 0;
phase = TP_SIZE_CHECK;
@@ -493,12 +493,12 @@ incoming_message_cb (void *cls,
if (num_received >= (max_size) / 10)
{
LOG (GNUNET_ERROR_TYPE_MESSAGE,
- "Size packet test done.\n");
+ "Size packet test done.\n");
LOG (GNUNET_ERROR_TYPE_MESSAGE,
- "%lu/%lu packets -- avg latency: %llu us\n",
- (unsigned long) num_received,
- (unsigned long) num_sent,
- (unsigned long long) avg_latency);
+ "%lu/%lu packets -- avg latency: %llu us\n",
+ (unsigned long) num_received,
+ (unsigned long) num_sent,
+ (unsigned long long) avg_latency);
num_received = 0;
num_sent = 0;
avg_latency = 0;
@@ -511,7 +511,7 @@ incoming_message_cb (void *cls,
break;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Finished\n");
+ "Finished\n");
GNUNET_SCHEDULER_shutdown ();
}
break;
@@ -640,9 +640,9 @@ main (int argc,
&peer_id[i].public_key);
GNUNET_free (private_key);
LOG (GNUNET_ERROR_TYPE_INFO,
- "Identity of peer %u is %s\n",
- i,
- GNUNET_i2s_full (&peer_id[i]));
+ "Identity of peer %u is %s\n",
+ i,
+ GNUNET_i2s_full (&peer_id[i]));
}
LOG (GNUNET_ERROR_TYPE_MESSAGE, "Starting test...\n");
GNUNET_SCHEDULER_run (&run,
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 2a7a1dfcb..772ad9f2d 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -671,8 +671,8 @@ handle_update_queue_message (void *cls,
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Received queue update message for %u with q_len %"PRIu64"\n",
- msg->qid, GNUNET_ntohll(msg->q_len));
+ "Received queue update message for %u with q_len %" PRIu64 "\n",
+ msg->qid, GNUNET_ntohll (msg->q_len));
tc_queue = tc_h->queue_head;
if (NULL != tc_queue)
{
@@ -947,6 +947,7 @@ shutdown_nat (void *cls)
shutdown_process (proc);
}
+
/**
* @brief Task run at shutdown to kill the resolver process
*
@@ -959,6 +960,7 @@ shutdown_resolver (void *cls)
shutdown_process (proc);
}
+
static void
resolver_start (struct
GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
@@ -967,16 +969,17 @@ resolver_start (struct
LOG (GNUNET_ERROR_TYPE_DEBUG, "resolver_start\n");
binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
- tc_h->resolver_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR
- | GNUNET_OS_USE_PIPE_CONTROL,
- NULL,
- NULL,
- NULL,
- binary,
- "gnunet-service-resolver",
- "-c",
- tc_h->cfg_filename,
- NULL);
+ tc_h->resolver_proc = GNUNET_OS_start_process (
+ GNUNET_OS_INHERIT_STD_OUT_AND_ERR
+ | GNUNET_OS_USE_PIPE_CONTROL,
+ NULL,
+ NULL,
+ NULL,
+ binary,
+ "gnunet-service-resolver",
+ "-c",
+ tc_h->cfg_filename,
+ NULL);
if (NULL == tc_h->resolver_proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start resolver service!");
@@ -987,6 +990,7 @@ resolver_start (struct
}
+
/**
* @brief Start NAT
*
diff --git a/src/transport/transport.h b/src/transport/transport.h
index a64ffd5c6..dbae4ecfb 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -903,7 +903,6 @@ struct GNUNET_TRANSPORT_UpdateQueueMessage
};
-
/**
* Remove queue, it is no longer available.
*/
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c
index cfa144415..d1e28cc36 100644
--- a/src/transport/transport_api2_communication.c
+++ b/src/transport/transport_api2_communication.c
@@ -420,6 +420,7 @@ send_add_queue (struct GNUNET_TRANSPORT_QueueHandle *qh)
GNUNET_MQ_send (qh->ch->mq, env);
}
+
/**
* Send message to the transport service about queue @a qh
* updated.
@@ -446,7 +447,6 @@ send_update_queue (struct GNUNET_TRANSPORT_QueueHandle *qh)
}
-
/**
* Send message to the transport service about queue @a qh
* being no longer available.
@@ -1033,7 +1033,6 @@ GNUNET_TRANSPORT_communicator_mq_update (
}
-
/**
* Notify transport service that an MQ became unavailable due to a
* disconnect or timeout.