diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-15 12:34:08 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-15 12:34:08 +0000 |
commit | d8e8c984562aaa22d2db7d178fb1e544a87f8222 (patch) | |
tree | 483f84fd79b079ad52fba0e37bfb9183c064b8e3 /src/transport/gnunet-service-transport_manipulation.c | |
parent | ad3f4ba6364c7c798c5b3549402fc77c6f8bb7c6 (diff) | |
download | gnunet-d8e8c984562aaa22d2db7d178fb1e544a87f8222.tar.gz gnunet-d8e8c984562aaa22d2db7d178fb1e544a87f8222.zip |
manipulation recv side
Diffstat (limited to 'src/transport/gnunet-service-transport_manipulation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_manipulation.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index fa8621e3d..5e52799df 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c | |||
@@ -288,10 +288,16 @@ GST_manipulation_recv (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
288 | struct TM_Peer *tmp; | 288 | struct TM_Peer *tmp; |
289 | int d; | 289 | int d; |
290 | struct GNUNET_ATS_Information ats_new[ats_count]; | 290 | struct GNUNET_ATS_Information ats_new[ats_count]; |
291 | struct GNUNET_TIME_Relative q_delay; | 291 | struct GNUNET_TIME_Relative quota_delay; |
292 | struct GNUNET_TIME_Relative m_delay; | 292 | struct GNUNET_TIME_Relative m_delay; |
293 | 293 | ||
294 | if (man_handle.delay_in.rel_value > GNUNET_TIME_UNIT_ZERO.rel_value) | ||
295 | m_delay = man_handle.delay_in; /* Global delay */ | ||
296 | else | ||
297 | m_delay = GNUNET_TIME_UNIT_ZERO; | ||
298 | |||
294 | for (d = 0; d < ats_count; d++) | 299 | for (d = 0; d < ats_count; d++) |
300 | ats_new[d] = ats[d]; | ||
295 | 301 | ||
296 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) | 302 | if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey))) |
297 | { | 303 | { |
@@ -306,27 +312,15 @@ GST_manipulation_recv (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
306 | } | 312 | } |
307 | /* Manipulate receive delay */ | 313 | /* Manipulate receive delay */ |
308 | if (UINT32_MAX != tmp->metrics[TM_RECEIVE][DELAY]) | 314 | if (UINT32_MAX != tmp->metrics[TM_RECEIVE][DELAY]) |
309 | { | 315 | m_delay.rel_value = tmp->metrics[TM_RECEIVE][DELAY]; /* Peer specific delay */ |
310 | m_delay.rel_value = tmp->metrics[TM_RECEIVE][DELAY]; | ||
311 | q_delay = GST_receive_callback (cls, peer, message, &ats_new[0], ats_count, | ||
312 | session, sender_address, sender_address_len); | ||
313 | |||
314 | if (q_delay.rel_value >= m_delay.rel_value) | ||
315 | { | ||
316 | return q_delay; | ||
317 | } | ||
318 | else | ||
319 | { | ||
320 | return m_delay; | ||
321 | } | ||
322 | } | ||
323 | else | ||
324 | return GST_receive_callback (cls, peer, message, &ats_new[0], ats_count, | ||
325 | session, sender_address, sender_address_len); | ||
326 | } | 316 | } |
327 | 317 | ||
328 | return GST_receive_callback (cls, peer, message, ats, ats_count, | 318 | quota_delay = GST_receive_callback (cls, peer, message, ats_new, ats_count, |
329 | session, sender_address, sender_address_len); | 319 | session, sender_address, sender_address_len); |
320 | if (quota_delay.rel_value > m_delay.rel_value) | ||
321 | return quota_delay; | ||
322 | else | ||
323 | return m_delay; | ||
330 | } | 324 | } |
331 | 325 | ||
332 | void | 326 | void |