aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-03-15 14:27:16 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-03-15 14:27:16 +0000
commit7df1fa12d8761e9a08a2aecc1611c398a1663b6f (patch)
tree3c5b4014ea5e80c7a9b9f8a77e8c27631b5006d3 /src/transport/transport_api.c
parentbfe1307e037a7811c2d9f86393554aa6ac09a957 (diff)
downloadgnunet-7df1fa12d8761e9a08a2aecc1611c398a1663b6f.tar.gz
gnunet-7df1fa12d8761e9a08a2aecc1611c398a1663b6f.zip
clean up
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r--src/transport/transport_api.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 16f821ab2..3b72ead5f 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -1213,7 +1213,8 @@ send_metric (void *cls, size_t size, void *buf)
1213 * 1213 *
1214 * @param handle transport handle 1214 * @param handle transport handle
1215 * @param peer the peer to set the metric for 1215 * @param peer the peer to set the metric for
1216 * @param direction can be: TM_SEND, TM_RECV, TM_BOTH 1216 * @param inbound set inbound direction (GNUNET_YES or GNUNET_NO)
1217 * @param outbound set outbound direction (GNUNET_YES or GNUNET_NO)
1217 * @param ats the metric as ATS information 1218 * @param ats the metric as ATS information
1218 * @param ats_count the number of metrics 1219 * @param ats_count the number of metrics
1219 * 1220 *
@@ -1236,7 +1237,8 @@ send_metric (void *cls, size_t size, void *buf)
1236void 1237void
1237GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle, 1238GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle,
1238 const struct GNUNET_PeerIdentity *peer, 1239 const struct GNUNET_PeerIdentity *peer,
1239 int direction, 1240 int inbound,
1241 int outbound,
1240 const struct GNUNET_ATS_Information *ats, 1242 const struct GNUNET_ATS_Information *ats,
1241 size_t ats_count) 1243 size_t ats_count)
1242{ 1244{
@@ -1244,9 +1246,11 @@ GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle,
1244 1246
1245 GNUNET_assert (NULL != handle); 1247 GNUNET_assert (NULL != handle);
1246 GNUNET_assert (NULL != peer); 1248 GNUNET_assert (NULL != peer);
1247 GNUNET_assert (direction >= TM_SEND); 1249 GNUNET_assert ((outbound == GNUNET_YES) || (outbound == GNUNET_NO));
1248 GNUNET_assert (direction <= TM_BOTH); 1250 GNUNET_assert ((inbound == GNUNET_YES) || (inbound == GNUNET_NO));
1249 1251
1252 if ((GNUNET_NO == inbound) && (GNUNET_NO == outbound))
1253 return;
1250 if (0 == ats_count) 1254 if (0 == ats_count)
1251 return; 1255 return;
1252 1256
@@ -1256,7 +1260,7 @@ GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle,
1256 msg = GNUNET_malloc (len); 1260 msg = GNUNET_malloc (len);
1257 msg->header.size = htons (len); 1261 msg->header.size = htons (len);
1258 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC); 1262 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC);
1259 msg->direction = htons (direction); 1263 msg->direction = htons (0 + outbound + 2 * inbound);
1260 msg->ats_count = htons (ats_count); 1264 msg->ats_count = htons (ats_count);
1261 msg->peer = (*peer); 1265 msg->peer = (*peer);
1262 memcpy (&msg[1], ats, ats_count * sizeof (struct GNUNET_ATS_Information)); 1266 memcpy (&msg[1], ats, ats_count * sizeof (struct GNUNET_ATS_Information));