aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-02-05 15:50:33 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-02-05 15:50:33 +0000
commitbd5e9a8250e9f1d30a8a8c772a84307ff0eb7fb2 (patch)
treefcbd95e4c2f6e229e3dafa16d4a846b2dd8b4d9d /src/transport
parent9ea6140052f8340045bf0b363030a1e6ab79a435 (diff)
downloadgnunet-bd5e9a8250e9f1d30a8a8c772a84307ff0eb7fb2.tar.gz
gnunet-bd5e9a8250e9f1d30a8a8c772a84307ff0eb7fb2.zip
fixes
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c5
-rw-r--r--src/transport/test_transport_api_manipulation_send_tcp.c14
2 files changed, 10 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index 74f903c98..c00d2b64e 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -263,9 +263,7 @@ GST_manipulation_recv (void *cls, const struct GNUNET_PeerIdentity *peer,
263 /* Set distance */ 263 /* Set distance */
264 if ((ntohl(ats[d].type) == GNUNET_ATS_QUALITY_NET_DISTANCE) && 264 if ((ntohl(ats[d].type) == GNUNET_ATS_QUALITY_NET_DISTANCE) &&
265 (UINT32_MAX != tmp->metrics[TM_RECEIVE][DISTANCE])) 265 (UINT32_MAX != tmp->metrics[TM_RECEIVE][DISTANCE]))
266 {
267 ats_new[d].value = htonl(tmp->metrics[TM_RECEIVE][DISTANCE]); 266 ats_new[d].value = htonl(tmp->metrics[TM_RECEIVE][DISTANCE]);
268 }
269 } 267 }
270 /* Manipulate receive delay */ 268 /* Manipulate receive delay */
271 if (UINT32_MAX != tmp->metrics[TM_RECEIVE][DELAY]) 269 if (UINT32_MAX != tmp->metrics[TM_RECEIVE][DELAY])
@@ -283,6 +281,9 @@ GST_manipulation_recv (void *cls, const struct GNUNET_PeerIdentity *peer,
283 return m_delay; 281 return m_delay;
284 } 282 }
285 } 283 }
284 else
285 return GST_receive_callback (cls, peer, message, &ats_new[0], ats_count,
286 session, sender_address, sender_address_len);
286 } 287 }
287 288
288 return GST_receive_callback (cls, peer, message, ats, ats_count, 289 return GST_receive_callback (cls, peer, message, ats, ats_count,
diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c
index cdef9921b..6e8489e6e 100644
--- a/src/transport/test_transport_api_manipulation_send_tcp.c
+++ b/src/transport/test_transport_api_manipulation_send_tcp.c
@@ -176,7 +176,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
176 176
177 char *ps = GNUNET_strdup (GNUNET_i2s (&p->id)); 177 char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
178 178
179 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
180 "Peer %u (`%4s') received message of type %d and size %u size from peer %u (`%4s')!\n", 180 "Peer %u (`%4s') received message of type %d and size %u size from peer %u (`%4s')!\n",
181 p->no, ps, ntohs (message->type), ntohs (message->size), t->no, 181 p->no, ps, ntohs (message->type), ntohs (message->size), t->no,
182 GNUNET_i2s (&t->id)); 182 GNUNET_i2s (&t->id));
@@ -210,7 +210,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
210 { 210 {
211 /* Received manipulated message */ 211 /* Received manipulated message */
212 dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed); 212 dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed);
213 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 213 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
214 "Received delayed message %u after %llu\n", 214 "Received delayed message %u after %llu\n",
215 messages_recv, 215 messages_recv,
216 (long long unsigned int) dur_delayed.rel_value); 216 (long long unsigned int) dur_delayed.rel_value);
@@ -284,7 +284,7 @@ notify_ready (void *cls, size_t size, void *buf)
284static void 284static void
285sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 285sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
286{ 286{
287 struct GNUNET_ATS_Information ats[2]; 287 struct GNUNET_ATS_Information ats[1];
288 send_task = GNUNET_SCHEDULER_NO_TASK; 288 send_task = GNUNET_SCHEDULER_NO_TASK;
289 289
290 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) 290 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
@@ -305,10 +305,10 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
305 { 305 {
306 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 306 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
307 ats[0].value = htonl (1000); 307 ats[0].value = htonl (1000);
308 ats[1].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); 308 GNUNET_TRANSPORT_set_traffic_metric (p2->th, &p1->id, TM_SEND, ats, 1);
309 ats[1].value = htonl (10); 309 ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
310 310 ats[0].value = htonl (10);
311 GNUNET_TRANSPORT_set_traffic_metric (p2->th, &p1->id, TM_SEND, ats, 2); 311 GNUNET_TRANSPORT_set_traffic_metric (p1->th, &p2->id, TM_BOTH, ats, 1);
312 312
313 start_delayed = GNUNET_TIME_absolute_get(); 313 start_delayed = GNUNET_TIME_absolute_get();
314 } 314 }