[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25859 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25859 - gnunet/src/ats |
Date: |
Wed, 23 Jan 2013 11:10:57 +0100 |
Author: wachs
Date: 2013-01-23 11:10:57 +0100 (Wed, 23 Jan 2013)
New Revision: 25859
Modified:
gnunet/src/ats/test_ats_simplistic_pref_aging.c
Log:
test
Modified: gnunet/src/ats/test_ats_simplistic_pref_aging.c
===================================================================
--- gnunet/src/ats/test_ats_simplistic_pref_aging.c 2013-01-23 09:17:28 UTC
(rev 25858)
+++ gnunet/src/ats/test_ats_simplistic_pref_aging.c 2013-01-23 10:10:57 UTC
(rev 25859)
@@ -169,7 +169,7 @@
/* Callback for initial suggestion */
if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u:
Callback for peer 0 `%s': (in/out) %llu/%llu\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u:
Callback for peer 0 `%s': (in/out) %llu/%llu\n",
stage,
GNUNET_i2s (&address->peer),
ntohl (bandwidth_in.value__),
@@ -180,7 +180,7 @@
}
if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u:
Callback for peer 1 `%s': (in/out) %llu/%llu\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u:
Callback for peer 1 `%s': (in/out) %llu/%llu\n",
stage,
GNUNET_i2s (&address->peer),
ntohl (bandwidth_in.value__),
@@ -205,7 +205,7 @@
/* Callback due to preference change */
if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u:
Callback for peer 0 `%s': (in/out) %llu/%llu\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u:
Callback for peer 0 `%s': (in/out) %llu/%llu\n",
stage,
GNUNET_i2s (&address->peer),
ntohl (bandwidth_in.value__),
@@ -222,7 +222,7 @@
}
if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u:
Callback for peer 1 `%s': (in/out) %llu/%llu\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u:
Callback for peer 1 `%s': (in/out) %llu/%llu\n",
stage,
GNUNET_i2s (&address->peer),
ntohl (bandwidth_in.value__),
@@ -231,9 +231,15 @@
/* Peer 1 should get less bandwidth */
if (cur_bandwidth_out >= p1_last_bandwidth_out)
+ {
GNUNET_break (0);
+ goto error;
+ }
if (cur_bandwidth_in >= p1_last_bandwidth_in)
+ {
GNUNET_break (0);
+ goto error;
+ }
p1_last_bandwidth_out =
ntohl(bandwidth_out.value__);
p1_last_bandwidth_in =
ntohl(bandwidth_in.value__);
}
@@ -250,7 +256,7 @@
/* Callback due to preference aging */
if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u:
Callback for peer 0 `%s': (in/out) %llu/%llu\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u:
Callback for peer 0 `%s': (in/out) %llu/%llu\n",
stage,
GNUNET_i2s (&address->peer),
ntohl (bandwidth_in.value__),
@@ -267,7 +273,7 @@
}
if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u:
Callback for peer 1 `%s': (in/out) %llu/%llu\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u:
Callback for peer 1 `%s': (in/out) %llu/%llu\n",
stage,
GNUNET_i2s (&address->peer),
ntohl (bandwidth_in.value__),
@@ -275,17 +281,34 @@
sug_p1 = GNUNET_YES;
/* Peer 1 should get more bandwidth */
if (cur_bandwidth_out <= p1_last_bandwidth_out)
+ {
GNUNET_break (0);
+ goto error;
+ }
if (cur_bandwidth_in <= p1_last_bandwidth_in)
+ {
GNUNET_break (0);
+ goto error;
+ }
p0_last_bandwidth_out =
ntohl(bandwidth_out.value__);
p0_last_bandwidth_in =
ntohl(bandwidth_in.value__);
}
- /* Done ! */
- GNUNET_SCHEDULER_add_now (&end,NULL);
- return;
+ if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1))
+ {
+ /* Done ! */
+ stage ++;
+ ret = 0;
+ GNUNET_SCHEDULER_add_now (&end,NULL);
+ return;
+ }
}
+ return;
+
+error:
+ /* Error ! */
+ ret = 1;
+ GNUNET_SCHEDULER_add_now (&end,NULL);
}
static void
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25859 - gnunet/src/ats,
gnunet <=