aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-04-11 14:40:54 +0000
committerBart Polot <bart@net.in.tum.de>2012-04-11 14:40:54 +0000
commit086884b58e7324dd4b237f189ddd6965534ff874 (patch)
tree929cd1e53702a197dfd562f632fc011c502f60fb /src/nse
parent8da491f4ba398dbaaf1b6b5dcdb80591c972ed70 (diff)
downloadgnunet-086884b58e7324dd4b237f189ddd6965534ff874.tar.gz
gnunet-086884b58e7324dd4b237f189ddd6965534ff874.zip
- Fixed 2202, removed debug stuff
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-service-nse.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 0f4c8f451..6a7248cb5 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -126,14 +126,6 @@ struct NSEPeerEntry
126 */ 126 */
127 int previous_round; 127 int previous_round;
128 128
129 /**
130 * Where a variable has been modified to cause a bug.
131 * FIXME DELETE AFTER DEBUG
132 */
133 int where_task;
134 int where_round;
135 int where_th;
136
137#if ENABLE_HISTOGRAM 129#if ENABLE_HISTOGRAM
138 130
139 /** 131 /**
@@ -577,7 +569,6 @@ transmit_ready (void *cls, size_t size, void *buf)
577 unsigned int idx; 569 unsigned int idx;
578 570
579 peer_entry->th = NULL; 571 peer_entry->th = NULL;
580 peer_entry->where_th = __LINE__;
581 if (NULL == buf) 572 if (NULL == buf)
582 { 573 {
583 /* client disconnected */ 574 /* client disconnected */
@@ -606,7 +597,7 @@ transmit_ready (void *cls, size_t size, void *buf)
606 GNUNET_STATISTICS_update (stats, 597 GNUNET_STATISTICS_update (stats,
607 "# flood messages not generated (lack of history)", 598 "# flood messages not generated (lack of history)",
608 1, GNUNET_NO); 599 1, GNUNET_NO);
609 return 0; // FIXME necessary? 600 return 0;
610 } 601 }
611#if DEBUG_NSE 602#if DEBUG_NSE
612 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 603 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -644,8 +635,7 @@ transmit_task_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
644 struct NSEPeerEntry *peer_entry = cls; 635 struct NSEPeerEntry *peer_entry = cls;
645 636
646 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; 637 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
647 peer_entry->where_task = __LINE__; 638
648
649 GNUNET_assert (NULL == peer_entry->th); 639 GNUNET_assert (NULL == peer_entry->th);
650 peer_entry->th = 640 peer_entry->th =
651 GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_NO, NSE_PRIORITY, 641 GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_NO, NSE_PRIORITY,
@@ -654,7 +644,6 @@ transmit_task_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
654 sizeof (struct 644 sizeof (struct
655 GNUNET_NSE_FloodMessage), 645 GNUNET_NSE_FloodMessage),
656 &transmit_ready, peer_entry); 646 &transmit_ready, peer_entry);
657 peer_entry->where_th = __LINE__;
658} 647}
659 648
660 649
@@ -728,14 +717,12 @@ schedule_current_round (void *cls, const GNUNET_HashCode * key, void *value)
728 if (NULL != peer_entry->th) 717 if (NULL != peer_entry->th)
729 { 718 {
730 peer_entry->previous_round = GNUNET_NO; 719 peer_entry->previous_round = GNUNET_NO;
731 peer_entry->where_round = __LINE__;
732 return GNUNET_OK; 720 return GNUNET_OK;
733 } 721 }
734 if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task) 722 if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task)
735 { 723 {
736 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); 724 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
737 peer_entry->previous_round = GNUNET_NO; 725 peer_entry->previous_round = GNUNET_NO;
738 peer_entry->where_round = __LINE__;
739 } 726 }
740#if ENABLE_HISTOGRAM 727#if ENABLE_HISTOGRAM
741 if (peer_entry->received_messages > 1) 728 if (peer_entry->received_messages > 1)
@@ -997,10 +984,6 @@ update_flood_times (void *cls, const GNUNET_HashCode * key, void *value)
997 NULL == peer_entry->th) 984 NULL == peer_entry->th)
998 { 985 {
999 GNUNET_break (0); 986 GNUNET_break (0);
1000 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "ROUND%d TASK%d TH%d\n",
1001 peer_entry->where_round,
1002 peer_entry->where_task,
1003 peer_entry->where_th);
1004 } 987 }
1005 return GNUNET_OK; 988 return GNUNET_OK;
1006 } 989 }
@@ -1008,7 +991,6 @@ update_flood_times (void *cls, const GNUNET_HashCode * key, void *value)
1008 { 991 {
1009 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); 992 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
1010 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; 993 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
1011 peer_entry->where_task = __LINE__;
1012 } 994 }
1013 delay = get_transmit_delay (0); 995 delay = get_transmit_delay (0);
1014 peer_entry->transmit_task = 996 peer_entry->transmit_task =
@@ -1130,13 +1112,11 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer,
1130 { 1112 {
1131 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); 1113 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
1132 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; 1114 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
1133 peer_entry->where_task = __LINE__;
1134 } 1115 }
1135 if (peer_entry->th != NULL) 1116 if (peer_entry->th != NULL)
1136 { 1117 {
1137 GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th); 1118 GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th);
1138 peer_entry->th = NULL; 1119 peer_entry->th = NULL;
1139 peer_entry->where_th = __LINE__;
1140 } 1120 }
1141 return GNUNET_OK; 1121 return GNUNET_OK;
1142 } 1122 }
@@ -1144,7 +1124,6 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer,
1144 { 1124 {
1145 if ((idx < estimate_index) && (peer_entry->previous_round == GNUNET_YES)) { 1125 if ((idx < estimate_index) && (peer_entry->previous_round == GNUNET_YES)) {
1146 peer_entry->previous_round = GNUNET_NO; 1126 peer_entry->previous_round = GNUNET_NO;
1147 peer_entry->where_round = __LINE__;
1148 } 1127 }
1149 /* push back our result now, that peer is spreading bad information... */ 1128 /* push back our result now, that peer is spreading bad information... */
1150 if (NULL == peer_entry->th) 1129 if (NULL == peer_entry->th)
@@ -1170,19 +1149,21 @@ handle_p2p_size_estimate (void *cls, const struct GNUNET_PeerIdentity *peer,
1170 /* cancel transmission from us to this peer for this round */ 1149 /* cancel transmission from us to this peer for this round */
1171 if (idx == estimate_index) 1150 if (idx == estimate_index)
1172 { 1151 {
1152 /* Cancel transmission in the other direction, as this peer clearly has
1153 up-to-date information already. Even if we didn't talk to this peer in
1154 the previous round, we should no longer send it stale information as it
1155 told us about the current round! */
1156 peer_entry->previous_round = GNUNET_YES;
1173 /* cancel any activity for current round */ 1157 /* cancel any activity for current round */
1174 // FIXME what if previous round was pending? (lost message?)
1175 if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK) 1158 if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK)
1176 { 1159 {
1177 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task); 1160 GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
1178 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; 1161 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
1179 peer_entry->where_task = __LINE__;
1180 } 1162 }
1181 if (peer_entry->th != NULL) 1163 if (peer_entry->th != NULL)
1182 { 1164 {
1183 GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th); 1165 GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th);
1184 peer_entry->th = NULL; 1166 peer_entry->th = NULL;
1185 peer_entry->where_th = __LINE__;
1186 } 1167 }
1187 } 1168 }
1188 else 1169 else
@@ -1240,9 +1221,6 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
1240 GNUNET_SCHEDULER_add_delayed (get_transmit_delay (-1), &transmit_task_cb, 1221 GNUNET_SCHEDULER_add_delayed (get_transmit_delay (-1), &transmit_task_cb,
1241 peer_entry); 1222 peer_entry);
1242 GNUNET_STATISTICS_update (stats, "# peers", 1, GNUNET_NO); 1223 GNUNET_STATISTICS_update (stats, "# peers", 1, GNUNET_NO);
1243 peer_entry->where_task = 0;
1244 peer_entry->where_round = __LINE__;
1245 peer_entry->where_th = __LINE__;
1246} 1224}
1247 1225
1248 1226
@@ -1274,13 +1252,11 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
1274 if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) { 1252 if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) {
1275 GNUNET_SCHEDULER_cancel (pos->transmit_task); 1253 GNUNET_SCHEDULER_cancel (pos->transmit_task);
1276 pos->transmit_task = GNUNET_SCHEDULER_NO_TASK; 1254 pos->transmit_task = GNUNET_SCHEDULER_NO_TASK;
1277 pos->where_task = __LINE__;
1278 } 1255 }
1279 if (pos->th != NULL) 1256 if (pos->th != NULL)
1280 { 1257 {
1281 GNUNET_CORE_notify_transmit_ready_cancel (pos->th); 1258 GNUNET_CORE_notify_transmit_ready_cancel (pos->th);
1282 pos->th = NULL; 1259 pos->th = NULL;
1283 pos->where_th = __LINE__;
1284 } 1260 }
1285 GNUNET_free (pos); 1261 GNUNET_free (pos);
1286 GNUNET_STATISTICS_update (stats, "# peers", -1, GNUNET_NO); 1262 GNUNET_STATISTICS_update (stats, "# peers", -1, GNUNET_NO);