aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_validation.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-04-02 11:40:17 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-04-02 11:40:17 +0000
commit8d69aeda86985616d001e8e18eb8d808edaf4fdb (patch)
treea7132c3ba14f03e3095ae4b009f1339e4bea2472 /src/transport/gnunet-service-transport_validation.c
parent26db97ede7c7a73fc7389479109fdc42aa0257d3 (diff)
downloadgnunet-8d69aeda86985616d001e8e18eb8d808edaf4fdb.tar.gz
gnunet-8d69aeda86985616d001e8e18eb8d808edaf4fdb.zip
- fix for debugging code
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r--src/transport/gnunet-service-transport_validation.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 6a13061cc..99db00561 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -251,6 +251,10 @@ struct ValidationEntry
251 * Are we expecting a PONG message for this validation entry? 251 * Are we expecting a PONG message for this validation entry?
252 */ 252 */
253 int expecting_pong; 253 int expecting_pong;
254
255 /* FIXME: DEBUGGING */
256 int last_line_set_to_no;
257 int last_line_set_to_yes;
254}; 258};
255 259
256 260
@@ -600,6 +604,9 @@ find_validation_entry (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
600 if (public_key == NULL) 604 if (public_key == NULL)
601 return NULL; 605 return NULL;
602 ve = GNUNET_malloc (sizeof (struct ValidationEntry)); 606 ve = GNUNET_malloc (sizeof (struct ValidationEntry));
607 ve->in_use = GNUNET_SYSERR; /* not defined */
608 ve->last_line_set_to_no = 0;
609 ve->last_line_set_to_yes = 0;
603 ve->address = GNUNET_HELLO_address_copy (address); 610 ve->address = GNUNET_HELLO_address_copy (address);
604 ve->public_key = *public_key; 611 ve->public_key = *public_key;
605 ve->pid = address->peer; 612 ve->pid = address->peer;
@@ -1220,7 +1227,6 @@ GST_validation_set_address_use (const struct GNUNET_HELLO_Address *address,
1220 int line) 1227 int line)
1221{ 1228{
1222 struct ValidationEntry *ve; 1229 struct ValidationEntry *ve;
1223 static int last_calling_line = 0;
1224 1230
1225 if (NULL != address) 1231 if (NULL != address)
1226 ve = find_validation_entry (NULL, address); 1232 ve = find_validation_entry (NULL, address);
@@ -1233,15 +1239,32 @@ GST_validation_set_address_use (const struct GNUNET_HELLO_Address *address,
1233 } 1239 }
1234 if (ve->in_use == in_use) 1240 if (ve->in_use == in_use)
1235 { 1241 {
1236 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1237 "Error setting address in use for peer `%s' `%s': %s -> %s; set last time by %i, called now by %i\n",
1238 1242
1239 GNUNET_i2s (&address->peer), GST_plugins_a2s (address), 1243 if (GNUNET_YES == in_use)
1240 (GNUNET_NO == ve->in_use) ? "NOT USED" : "USED", 1244 {
1241 (GNUNET_NO == in_use) ? "NOT USED" : "USED", 1245 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1242 last_calling_line, line); 1246 "Error setting address in use for peer `%s' `%s' to USED: set last time by %i, called now by %i\n",
1247 GNUNET_i2s (&address->peer), GST_plugins_a2s (address),
1248 ve->last_line_set_to_yes, line);
1249 }
1250 if (GNUNET_NO == in_use)
1251 {
1252 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1253 "Error setting address in use for peer `%s' `%s' to NOT_USED: set last time by %i, called now by %i\n",
1254 GNUNET_i2s (&address->peer), GST_plugins_a2s (address),
1255 ve->last_line_set_to_no, line);
1256 }
1257 }
1258
1259 if (GNUNET_YES == in_use)
1260 {
1261 ve->last_line_set_to_yes = line;
1243 } 1262 }
1244 last_calling_line = line; 1263 if (GNUNET_NO == in_use)
1264 {
1265 ve->last_line_set_to_no = line;
1266 }
1267
1245 GNUNET_break (ve->in_use != in_use); /* should be different... */ 1268 GNUNET_break (ve->in_use != in_use); /* should be different... */
1246 ve->in_use = in_use; 1269 ve->in_use = in_use;
1247 if (in_use == GNUNET_YES) 1270 if (in_use == GNUNET_YES)