diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-06-10 00:10:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-06-10 00:10:05 +0000 |
commit | e312e046236e754e12161157fbfdf9e89b919e33 (patch) | |
tree | 3d36da490c181832677ee1fe17a449e46b2b0720 /src/core | |
parent | f1696b714e33c293f4243be27ccfa6fd2f305518 (diff) | |
download | gnunet-e312e046236e754e12161157fbfdf9e89b919e33.tar.gz gnunet-e312e046236e754e12161157fbfdf9e89b919e33.zip |
fixes
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.h | 2 | ||||
-rw-r--r-- | src/core/core_api.c | 10 | ||||
-rw-r--r-- | src/core/gnunet-service-core.c | 94 | ||||
-rw-r--r-- | src/core/test_core_api.c | 4 | ||||
-rw-r--r-- | src/core/test_core_api_peer1.conf | 10 | ||||
-rw-r--r-- | src/core/test_core_api_peer2.conf | 8 |
6 files changed, 110 insertions, 18 deletions
diff --git a/src/core/core.h b/src/core/core.h index fadb81344..fe8bcf9cc 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
@@ -29,7 +29,7 @@ | |||
29 | /** | 29 | /** |
30 | * General core debugging. | 30 | * General core debugging. |
31 | */ | 31 | */ |
32 | #define DEBUG_CORE GNUNET_YES | 32 | #define DEBUG_CORE GNUNET_NO |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Debugging interaction core-clients. | 35 | * Debugging interaction core-clients. |
diff --git a/src/core/core_api.c b/src/core/core_api.c index 61836e590..02379e36e 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -427,9 +427,11 @@ main_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
427 | return; | 427 | return; |
428 | } | 428 | } |
429 | msize = ntohs (msg->size); | 429 | msize = ntohs (msg->size); |
430 | #if DEBUG_CORE | ||
430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 431 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
431 | "Processing message of type %u and size %u from core service\n", | 432 | "Processing message of type %u and size %u from core service\n", |
432 | ntohs (msg->type), msize); | 433 | ntohs (msg->type), msize); |
434 | #endif | ||
433 | switch (ntohs (msg->type)) | 435 | switch (ntohs (msg->type)) |
434 | { | 436 | { |
435 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT: | 437 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT: |
@@ -468,9 +470,11 @@ main_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
468 | } | 470 | } |
469 | ntm = (const struct NotifyTrafficMessage *) msg; | 471 | ntm = (const struct NotifyTrafficMessage *) msg; |
470 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; | 472 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; |
473 | #if DEBUG_CORE | ||
471 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 474 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
472 | "Received message of type %u from peer `%4s'\n", | 475 | "Received message of type %u from peer `%4s'\n", |
473 | ntohs (em->type), GNUNET_i2s (&ntm->peer)); | 476 | ntohs (em->type), GNUNET_i2s (&ntm->peer)); |
477 | #endif | ||
474 | if ((GNUNET_NO == h->inbound_hdr_only) && | 478 | if ((GNUNET_NO == h->inbound_hdr_only) && |
475 | (msize != ntohs (em->size) + sizeof (struct NotifyTrafficMessage))) | 479 | (msize != ntohs (em->size) + sizeof (struct NotifyTrafficMessage))) |
476 | { | 480 | { |
@@ -620,9 +624,11 @@ init_reply_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
620 | } | 624 | } |
621 | m = (const struct InitReplyMessage *) msg; | 625 | m = (const struct InitReplyMessage *) msg; |
622 | /* start our message processing loop */ | 626 | /* start our message processing loop */ |
627 | #if DEBUG_CORE | ||
623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 628 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
624 | _ | 629 | _ |
625 | ("Successfully connected to core service, starting processing loop.\n")); | 630 | ("Successfully connected to core service, starting processing loop.\n")); |
631 | #endif | ||
626 | h->currently_down = GNUNET_NO; | 632 | h->currently_down = GNUNET_NO; |
627 | trigger_next_request (h); | 633 | trigger_next_request (h); |
628 | GNUNET_CLIENT_receive (h->client, | 634 | GNUNET_CLIENT_receive (h->client, |
@@ -631,8 +637,10 @@ init_reply_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
631 | { | 637 | { |
632 | /* mark so we don't call init on reconnect */ | 638 | /* mark so we don't call init on reconnect */ |
633 | h->init = NULL; | 639 | h->init = NULL; |
640 | #if DEBUG_CORE | ||
634 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 641 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
635 | _("Successfully connected to core service.\n")); | 642 | _("Successfully connected to core service.\n")); |
643 | #endif | ||
636 | GNUNET_CRYPTO_hash (&m->publicKey, | 644 | GNUNET_CRYPTO_hash (&m->publicKey, |
637 | sizeof (struct | 645 | sizeof (struct |
638 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 646 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
@@ -800,9 +808,11 @@ GNUNET_CORE_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
800 | GNUNET_assert (h->hcnt < | 808 | GNUNET_assert (h->hcnt < |
801 | (GNUNET_SERVER_MAX_MESSAGE_SIZE - | 809 | (GNUNET_SERVER_MAX_MESSAGE_SIZE - |
802 | sizeof (struct InitMessage)) / sizeof (uint16_t)); | 810 | sizeof (struct InitMessage)) / sizeof (uint16_t)); |
811 | #if DEBUG_CORE | ||
803 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 812 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
804 | "Trying to connect to core service in next %llu ms.\n", | 813 | "Trying to connect to core service in next %llu ms.\n", |
805 | timeout.value); | 814 | timeout.value); |
815 | #endif | ||
806 | h->th = | 816 | h->th = |
807 | GNUNET_CLIENT_notify_transmit_ready (h->client, | 817 | GNUNET_CLIENT_notify_transmit_ready (h->client, |
808 | sizeof (struct InitMessage) + | 818 | sizeof (struct InitMessage) + |
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 0d448c8eb..8f64bf366 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -1065,10 +1065,12 @@ notify_encrypted_transmit_ready (void *cls, size_t size, void *buf) | |||
1065 | memcpy (cbuf, &m[1], m->size); | 1065 | memcpy (cbuf, &m[1], m->size); |
1066 | ret = m->size; | 1066 | ret = m->size; |
1067 | process_encrypted_neighbour_queue (n); | 1067 | process_encrypted_neighbour_queue (n); |
1068 | #if DEBUG_CORE | ||
1068 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1069 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1069 | "Copied message of type %u and size %u into transport buffer for `%4s'\n", | 1070 | "Copied message of type %u and size %u into transport buffer for `%4s'\n", |
1070 | ntohs (((struct GNUNET_MessageHeader *) &m[1])->type), | 1071 | ntohs (((struct GNUNET_MessageHeader *) &m[1])->type), |
1071 | ret, GNUNET_i2s (&n->peer)); | 1072 | ret, GNUNET_i2s (&n->peer)); |
1073 | #endif | ||
1072 | } | 1074 | } |
1073 | else | 1075 | else |
1074 | { | 1076 | { |
@@ -1110,6 +1112,7 @@ process_encrypted_neighbour_queue (struct Neighbour *n) | |||
1110 | process_plaintext_neighbour_queue (n); | 1112 | process_plaintext_neighbour_queue (n); |
1111 | return; | 1113 | return; |
1112 | } | 1114 | } |
1115 | #if DEBUG_CORE | ||
1113 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1116 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1114 | "Asking transport for transmission of %u bytes to `%4s' in next %llu ms\n", | 1117 | "Asking transport for transmission of %u bytes to `%4s' in next %llu ms\n", |
1115 | n->encrypted_head->size, | 1118 | n->encrypted_head->size, |
@@ -1117,6 +1120,7 @@ process_encrypted_neighbour_queue (struct Neighbour *n) | |||
1117 | GNUNET_TIME_absolute_get_remaining (n-> | 1120 | GNUNET_TIME_absolute_get_remaining (n-> |
1118 | encrypted_head->deadline). | 1121 | encrypted_head->deadline). |
1119 | value); | 1122 | value); |
1123 | #endif | ||
1120 | n->th = | 1124 | n->th = |
1121 | GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, | 1125 | GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, |
1122 | n->encrypted_head->size, | 1126 | n->encrypted_head->size, |
@@ -1172,9 +1176,11 @@ do_decrypt (struct Neighbour *n, | |||
1172 | GNUNET_break (0); | 1176 | GNUNET_break (0); |
1173 | return GNUNET_SYSERR; | 1177 | return GNUNET_SYSERR; |
1174 | } | 1178 | } |
1179 | #if DEBUG_CORE | ||
1175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1180 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1176 | "Decrypted %u bytes from `%4s' using key %u\n", | 1181 | "Decrypted %u bytes from `%4s' using key %u\n", |
1177 | size, GNUNET_i2s (&n->peer), n->decrypt_key.crc32); | 1182 | size, GNUNET_i2s (&n->peer), n->decrypt_key.crc32); |
1183 | #endif | ||
1178 | return GNUNET_OK; | 1184 | return GNUNET_OK; |
1179 | } | 1185 | } |
1180 | 1186 | ||
@@ -1207,9 +1213,11 @@ do_encrypt (struct Neighbour *n, | |||
1207 | (const struct | 1213 | (const struct |
1208 | GNUNET_CRYPTO_AesInitializationVector | 1214 | GNUNET_CRYPTO_AesInitializationVector |
1209 | *) iv, out)); | 1215 | *) iv, out)); |
1216 | #if DEBUG_CORE | ||
1210 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1211 | "Encrypted %u bytes for `%4s' using key %u\n", size, | 1218 | "Encrypted %u bytes for `%4s' using key %u\n", size, |
1212 | GNUNET_i2s (&n->peer), n->encrypt_key.crc32); | 1219 | GNUNET_i2s (&n->peer), n->encrypt_key.crc32); |
1220 | #endif | ||
1213 | return GNUNET_OK; | 1221 | return GNUNET_OK; |
1214 | } | 1222 | } |
1215 | 1223 | ||
@@ -1357,9 +1365,11 @@ select_messages (struct Neighbour *n, | |||
1357 | pos->do_transmit = GNUNET_NO; /* mark for not transmitting! */ | 1365 | pos->do_transmit = GNUNET_NO; /* mark for not transmitting! */ |
1358 | pos = pos->next; | 1366 | pos = pos->next; |
1359 | } | 1367 | } |
1368 | #if DEBUG_CORE | ||
1360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1369 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1361 | "Selected %u bytes of plaintext messages for transmission to `%4s'.\n", | 1370 | "Selected %u bytes of plaintext messages for transmission to `%4s'.\n", |
1362 | off, GNUNET_i2s (&n->peer)); | 1371 | off, GNUNET_i2s (&n->peer)); |
1372 | #endif | ||
1363 | return off; | 1373 | return off; |
1364 | } | 1374 | } |
1365 | 1375 | ||
@@ -1395,7 +1405,7 @@ batch_message (struct Neighbour *n, | |||
1395 | *retry_time = GNUNET_TIME_UNIT_FOREVER_REL; | 1405 | *retry_time = GNUNET_TIME_UNIT_FOREVER_REL; |
1396 | if (0 == select_messages (n, size, retry_time)) | 1406 | if (0 == select_messages (n, size, retry_time)) |
1397 | { | 1407 | { |
1398 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1408 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1399 | "No messages selected, will try again in %llu ms\n", | 1409 | "No messages selected, will try again in %llu ms\n", |
1400 | retry_time->value); | 1410 | retry_time->value); |
1401 | return 0; | 1411 | return 0; |
@@ -1496,23 +1506,29 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
1496 | { | 1506 | { |
1497 | case PEER_STATE_DOWN: | 1507 | case PEER_STATE_DOWN: |
1498 | send_key (n); | 1508 | send_key (n); |
1509 | #if DEBUG_CORE | ||
1499 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1510 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1500 | "Not yet connected to `%4s', deferring processing of plaintext messages.\n", | 1511 | "Not yet connected to `%4s', deferring processing of plaintext messages.\n", |
1501 | GNUNET_i2s(&n->peer)); | 1512 | GNUNET_i2s(&n->peer)); |
1513 | #endif | ||
1502 | return; | 1514 | return; |
1503 | case PEER_STATE_KEY_SENT: | 1515 | case PEER_STATE_KEY_SENT: |
1504 | GNUNET_assert (n->retry_set_key_task != | 1516 | GNUNET_assert (n->retry_set_key_task != |
1505 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK); | 1517 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK); |
1518 | #if DEBUG_CORE | ||
1506 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1507 | "Not yet connected to `%4s', deferring processing of plaintext messages.\n", | 1520 | "Not yet connected to `%4s', deferring processing of plaintext messages.\n", |
1508 | GNUNET_i2s(&n->peer)); | 1521 | GNUNET_i2s(&n->peer)); |
1522 | #endif | ||
1509 | return; | 1523 | return; |
1510 | case PEER_STATE_KEY_RECEIVED: | 1524 | case PEER_STATE_KEY_RECEIVED: |
1511 | GNUNET_assert (n->retry_set_key_task != | 1525 | GNUNET_assert (n->retry_set_key_task != |
1512 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK); | 1526 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK); |
1527 | #if DEBUG_CORE | ||
1513 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1528 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1514 | "Not yet connected to `%4s', deferring processing of plaintext messages.\n", | 1529 | "Not yet connected to `%4s', deferring processing of plaintext messages.\n", |
1515 | GNUNET_i2s(&n->peer)); | 1530 | GNUNET_i2s(&n->peer)); |
1531 | #endif | ||
1516 | return; | 1532 | return; |
1517 | case PEER_STATE_KEY_CONFIRMED: | 1533 | case PEER_STATE_KEY_CONFIRMED: |
1518 | /* ready to continue */ | 1534 | /* ready to continue */ |
@@ -1520,17 +1536,21 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
1520 | } | 1536 | } |
1521 | if (n->messages == NULL) | 1537 | if (n->messages == NULL) |
1522 | { | 1538 | { |
1539 | #if DEBUG_CORE | ||
1523 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1540 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1524 | "Plaintext message queue for `%4s' is empty.\n", | 1541 | "Plaintext message queue for `%4s' is empty.\n", |
1525 | GNUNET_i2s(&n->peer)); | 1542 | GNUNET_i2s(&n->peer)); |
1543 | #endif | ||
1526 | return; /* no pending messages */ | 1544 | return; /* no pending messages */ |
1527 | } | 1545 | } |
1528 | discard_expired_messages (n); | 1546 | discard_expired_messages (n); |
1529 | if (n->encrypted_head != NULL) | 1547 | if (n->encrypted_head != NULL) |
1530 | { | 1548 | { |
1549 | #if DEBUG_CORE | ||
1531 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1550 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1532 | "Encrypted message queue for `%4s' is still full, delaying plaintext processing.\n", | 1551 | "Encrypted message queue for `%4s' is still full, delaying plaintext processing.\n", |
1533 | GNUNET_i2s(&n->peer)); | 1552 | GNUNET_i2s(&n->peer)); |
1553 | #endif | ||
1534 | return; /* wait for messages already encrypted to be | 1554 | return; /* wait for messages already encrypted to be |
1535 | processed first! */ | 1555 | processed first! */ |
1536 | } | 1556 | } |
@@ -1545,9 +1565,11 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
1545 | &deadline, &retry_time, &priority); | 1565 | &deadline, &retry_time, &priority); |
1546 | if (used == sizeof (struct EncryptedMessage)) | 1566 | if (used == sizeof (struct EncryptedMessage)) |
1547 | { | 1567 | { |
1568 | #if DEBUG_CORE | ||
1548 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1569 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1549 | "No messages selected for transmission to `%4s' at this time, will try again later.\n", | 1570 | "No messages selected for transmission to `%4s' at this time, will try again later.\n", |
1550 | GNUNET_i2s(&n->peer)); | 1571 | GNUNET_i2s(&n->peer)); |
1572 | #endif | ||
1551 | /* no messages selected for sending, try again later... */ | 1573 | /* no messages selected for sending, try again later... */ |
1552 | n->retry_plaintext_task = | 1574 | n->retry_plaintext_task = |
1553 | GNUNET_SCHEDULER_add_delayed (sched, | 1575 | GNUNET_SCHEDULER_add_delayed (sched, |
@@ -1575,10 +1597,12 @@ process_plaintext_neighbour_queue (struct Neighbour *n) | |||
1575 | esize = used - ENCRYPTED_HEADER_SIZE; | 1597 | esize = used - ENCRYPTED_HEADER_SIZE; |
1576 | GNUNET_CRYPTO_hash (&ph->sequence_number, esize, &em->plaintext_hash); | 1598 | GNUNET_CRYPTO_hash (&ph->sequence_number, esize, &em->plaintext_hash); |
1577 | /* encrypt */ | 1599 | /* encrypt */ |
1600 | #if DEBUG_CORE | ||
1578 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1601 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1579 | "Encrypting %u bytes of plaintext messages for `%4s' for transmission.\n", | 1602 | "Encrypting %u bytes of plaintext messages for `%4s' for transmission.\n", |
1580 | esize, | 1603 | esize, |
1581 | GNUNET_i2s(&n->peer)); | 1604 | GNUNET_i2s(&n->peer)); |
1605 | #endif | ||
1582 | GNUNET_assert (GNUNET_OK == | 1606 | GNUNET_assert (GNUNET_OK == |
1583 | do_encrypt (n, | 1607 | do_encrypt (n, |
1584 | &em->plaintext_hash, | 1608 | &em->plaintext_hash, |
@@ -1621,17 +1645,21 @@ send_connect_continuation (void *cls, size_t size, void *buf) | |||
1621 | 1645 | ||
1622 | if (buf == NULL) | 1646 | if (buf == NULL) |
1623 | { | 1647 | { |
1648 | #if DEBUG_CORE | ||
1624 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1649 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1625 | "Asked to send message to disconnected peer `%4s' and connection failed. Discarding message.\n", | 1650 | "Asked to send message to disconnected peer `%4s' and connection failed. Discarding message.\n", |
1626 | GNUNET_i2s (&sm->peer)); | 1651 | GNUNET_i2s (&sm->peer)); |
1652 | #endif | ||
1627 | GNUNET_free (sm); | 1653 | GNUNET_free (sm); |
1628 | /* FIXME: do we need to do something here to let the | 1654 | /* FIXME: do we need to do something here to let the |
1629 | client know about the failure!? */ | 1655 | client know about the failure!? */ |
1630 | return 0; | 1656 | return 0; |
1631 | } | 1657 | } |
1658 | #if DEBUG_CORE | ||
1632 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1659 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1633 | "Connection to peer `%4s' succeeded, retrying original transmission request\n", | 1660 | "Connection to peer `%4s' succeeded, retrying original transmission request\n", |
1634 | GNUNET_i2s (&sm->peer)); | 1661 | GNUNET_i2s (&sm->peer)); |
1662 | #endif | ||
1635 | handle_client_send (NULL, NULL, &sm->header); | 1663 | handle_client_send (NULL, NULL, &sm->header); |
1636 | GNUNET_free (sm); | 1664 | GNUNET_free (sm); |
1637 | return 0; | 1665 | return 0; |
@@ -1677,11 +1705,13 @@ handle_client_send (void *cls, | |||
1677 | n = find_neighbour (&sm->peer); | 1705 | n = find_neighbour (&sm->peer); |
1678 | if (n == NULL) | 1706 | if (n == NULL) |
1679 | { | 1707 | { |
1708 | #if DEBUG_CORE | ||
1680 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1709 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1681 | "Core received `%s' request for `%4s', will try to establish connection within %llu ms\n", | 1710 | "Core received `%s' request for `%4s', will try to establish connection within %llu ms\n", |
1682 | "SEND", | 1711 | "SEND", |
1683 | GNUNET_i2s (&sm->peer), | 1712 | GNUNET_i2s (&sm->peer), |
1684 | sm->deadline.value); | 1713 | sm->deadline.value); |
1714 | #endif | ||
1685 | msize += sizeof (struct SendMessage); | 1715 | msize += sizeof (struct SendMessage); |
1686 | /* ask transport to connect to the peer */ | 1716 | /* ask transport to connect to the peer */ |
1687 | /* FIXME: this code does not handle the | 1717 | /* FIXME: this code does not handle the |
@@ -1702,11 +1732,13 @@ handle_client_send (void *cls, | |||
1702 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1732 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1703 | return; | 1733 | return; |
1704 | } | 1734 | } |
1735 | #if DEBUG_CORE | ||
1705 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1736 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1706 | "Core received `%s' request, queueing %u bytes of plaintext data for transmission to `%4s'.\n", | 1737 | "Core received `%s' request, queueing %u bytes of plaintext data for transmission to `%4s'.\n", |
1707 | "SEND", | 1738 | "SEND", |
1708 | msize, | 1739 | msize, |
1709 | GNUNET_i2s (&sm->peer)); | 1740 | GNUNET_i2s (&sm->peer)); |
1741 | #endif | ||
1710 | /* FIXME: consider bounding queue size */ | 1742 | /* FIXME: consider bounding queue size */ |
1711 | e = GNUNET_malloc (sizeof (struct MessageEntry) + msize); | 1743 | e = GNUNET_malloc (sizeof (struct MessageEntry) + msize); |
1712 | e->deadline = GNUNET_TIME_absolute_ntoh (sm->deadline); | 1744 | e->deadline = GNUNET_TIME_absolute_ntoh (sm->deadline); |
@@ -1777,10 +1809,12 @@ process_hello_retry_send_key (void *cls, | |||
1777 | return; | 1809 | return; |
1778 | if (n->public_key != NULL) | 1810 | if (n->public_key != NULL) |
1779 | return; | 1811 | return; |
1812 | #if DEBUG_CORE | ||
1780 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1813 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1781 | "Received new `%s' message for `%4s', initiating key exchange.\n", | 1814 | "Received new `%s' message for `%4s', initiating key exchange.\n", |
1782 | "HELLO", | 1815 | "HELLO", |
1783 | GNUNET_i2s (peer)); | 1816 | GNUNET_i2s (peer)); |
1817 | #endif | ||
1784 | n->public_key = | 1818 | n->public_key = |
1785 | GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); | 1819 | GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); |
1786 | if (GNUNET_OK != GNUNET_HELLO_get_key (hello, n->public_key)) | 1820 | if (GNUNET_OK != GNUNET_HELLO_get_key (hello, n->public_key)) |
@@ -1823,15 +1857,19 @@ send_key (struct Neighbour *n) | |||
1823 | struct PingMessage pp; | 1857 | struct PingMessage pp; |
1824 | struct PingMessage *pm; | 1858 | struct PingMessage *pm; |
1825 | 1859 | ||
1860 | #if DEBUG_CORE | ||
1826 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1861 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1827 | "Asked to perform key exchange with `%4s'.\n", | 1862 | "Asked to perform key exchange with `%4s'.\n", |
1828 | GNUNET_i2s (&n->peer)); | 1863 | GNUNET_i2s (&n->peer)); |
1864 | #endif | ||
1829 | if (n->public_key == NULL) | 1865 | if (n->public_key == NULL) |
1830 | { | 1866 | { |
1831 | /* lookup n's public key, then try again */ | 1867 | /* lookup n's public key, then try again */ |
1868 | #if DEBUG_CORE | ||
1832 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1869 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1833 | "Lacking public key for `%4s', trying to obtain one.\n", | 1870 | "Lacking public key for `%4s', trying to obtain one.\n", |
1834 | GNUNET_i2s (&n->peer)); | 1871 | GNUNET_i2s (&n->peer)); |
1872 | #endif | ||
1835 | GNUNET_PEERINFO_for_all (cfg, | 1873 | GNUNET_PEERINFO_for_all (cfg, |
1836 | sched, | 1874 | sched, |
1837 | &n->peer, | 1875 | &n->peer, |
@@ -1887,6 +1925,7 @@ send_key (struct Neighbour *n) | |||
1887 | pm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_PING); | 1925 | pm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_PING); |
1888 | pp.challenge = htonl (n->ping_challenge); | 1926 | pp.challenge = htonl (n->ping_challenge); |
1889 | pp.target = n->peer; | 1927 | pp.target = n->peer; |
1928 | #if DEBUG_CORE | ||
1890 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1929 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1891 | "Encrypting `%s' and `%s' messages for `%4s'.\n", | 1930 | "Encrypting `%s' and `%s' messages for `%4s'.\n", |
1892 | "SET_KEY", "PING", GNUNET_i2s (&n->peer)); | 1931 | "SET_KEY", "PING", GNUNET_i2s (&n->peer)); |
@@ -1894,6 +1933,7 @@ send_key (struct Neighbour *n) | |||
1894 | "Sending `%s' to `%4s' with challenge %u encrypted using key %u\n", | 1933 | "Sending `%s' to `%4s' with challenge %u encrypted using key %u\n", |
1895 | "PING", | 1934 | "PING", |
1896 | GNUNET_i2s (&n->peer), n->ping_challenge, n->encrypt_key.crc32); | 1935 | GNUNET_i2s (&n->peer), n->ping_challenge, n->encrypt_key.crc32); |
1936 | #endif | ||
1897 | do_encrypt (n, | 1937 | do_encrypt (n, |
1898 | &n->peer.hashPubKey, | 1938 | &n->peer.hashPubKey, |
1899 | &pp.challenge, | 1939 | &pp.challenge, |
@@ -1982,9 +2022,11 @@ process_hello_retry_handle_set_key (void *cls, | |||
1982 | n->public_key = NULL; | 2022 | n->public_key = NULL; |
1983 | return; | 2023 | return; |
1984 | } | 2024 | } |
2025 | #if DEBUG_CORE | ||
1985 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2026 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1986 | "Received `%s' for `%4s', continuing processing of `%s' message.\n", | 2027 | "Received `%s' for `%4s', continuing processing of `%s' message.\n", |
1987 | "HELLO", GNUNET_i2s (peer), "SET_KEY"); | 2028 | "HELLO", GNUNET_i2s (peer), "SET_KEY"); |
2029 | #endif | ||
1988 | handle_set_key (n, sm); | 2030 | handle_set_key (n, sm); |
1989 | } | 2031 | } |
1990 | 2032 | ||
@@ -2003,9 +2045,11 @@ handle_ping (struct Neighbour *n, const struct PingMessage *m) | |||
2003 | struct PingMessage *tp; | 2045 | struct PingMessage *tp; |
2004 | struct MessageEntry *me; | 2046 | struct MessageEntry *me; |
2005 | 2047 | ||
2048 | #if DEBUG_CORE | ||
2006 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2049 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2007 | "Core service receives `%s' request from `%4s'.\n", | 2050 | "Core service receives `%s' request from `%4s'.\n", |
2008 | "PING", GNUNET_i2s (&n->peer)); | 2051 | "PING", GNUNET_i2s (&n->peer)); |
2052 | #endif | ||
2009 | if (GNUNET_OK != | 2053 | if (GNUNET_OK != |
2010 | do_decrypt (n, | 2054 | do_decrypt (n, |
2011 | &my_identity.hashPubKey, | 2055 | &my_identity.hashPubKey, |
@@ -2014,6 +2058,7 @@ handle_ping (struct Neighbour *n, const struct PingMessage *m) | |||
2014 | sizeof (struct PingMessage) - | 2058 | sizeof (struct PingMessage) - |
2015 | sizeof (struct GNUNET_MessageHeader))) | 2059 | sizeof (struct GNUNET_MessageHeader))) |
2016 | return; | 2060 | return; |
2061 | #if DEBUG_CORE | ||
2017 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2062 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2018 | "Decrypted `%s' to `%4s' with challenge %u decrypted using key %u\n", | 2063 | "Decrypted `%s' to `%4s' with challenge %u decrypted using key %u\n", |
2019 | "PING", | 2064 | "PING", |
@@ -2022,6 +2067,7 @@ handle_ping (struct Neighbour *n, const struct PingMessage *m) | |||
2022 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2067 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2023 | "Target of `%s' request is `%4s'.\n", | 2068 | "Target of `%s' request is `%4s'.\n", |
2024 | "PING", GNUNET_i2s (&t.target)); | 2069 | "PING", GNUNET_i2s (&t.target)); |
2070 | #endif | ||
2025 | if (0 != memcmp (&t.target, | 2071 | if (0 != memcmp (&t.target, |
2026 | &my_identity, sizeof (struct GNUNET_PeerIdentity))) | 2072 | &my_identity, sizeof (struct GNUNET_PeerIdentity))) |
2027 | { | 2073 | { |
@@ -2049,9 +2095,11 @@ handle_ping (struct Neighbour *n, const struct PingMessage *m) | |||
2049 | &tp->challenge, | 2095 | &tp->challenge, |
2050 | sizeof (struct PingMessage) - | 2096 | sizeof (struct PingMessage) - |
2051 | sizeof (struct GNUNET_MessageHeader)); | 2097 | sizeof (struct GNUNET_MessageHeader)); |
2098 | #if DEBUG_CORE | ||
2052 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2099 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2053 | "Encrypting `%s' with challenge %u using key %u\n", "PONG", | 2100 | "Encrypting `%s' with challenge %u using key %u\n", "PONG", |
2054 | ntohl (t.challenge), n->encrypt_key.crc32); | 2101 | ntohl (t.challenge), n->encrypt_key.crc32); |
2102 | #endif | ||
2055 | /* trigger queue processing */ | 2103 | /* trigger queue processing */ |
2056 | process_encrypted_neighbour_queue (n); | 2104 | process_encrypted_neighbour_queue (n); |
2057 | } | 2105 | } |
@@ -2073,9 +2121,11 @@ handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m) | |||
2073 | struct PingMessage *ping; | 2121 | struct PingMessage *ping; |
2074 | enum PeerStateMachine sender_status; | 2122 | enum PeerStateMachine sender_status; |
2075 | 2123 | ||
2124 | #if DEBUG_CORE | ||
2076 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2077 | "Core service receives `%s' request from `%4s'.\n", | 2126 | "Core service receives `%s' request from `%4s'.\n", |
2078 | "SET_KEY", GNUNET_i2s (&n->peer)); | 2127 | "SET_KEY", GNUNET_i2s (&n->peer)); |
2128 | #endif | ||
2079 | if (n->public_key == NULL) | 2129 | if (n->public_key == NULL) |
2080 | { | 2130 | { |
2081 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2131 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2115,7 +2165,9 @@ handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m) | |||
2115 | GNUNET_break_op (0); | 2165 | GNUNET_break_op (0); |
2116 | return; | 2166 | return; |
2117 | } | 2167 | } |
2168 | #if DEBUG_CORE | ||
2118 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Decrypting key material.\n"); | 2169 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Decrypting key material.\n"); |
2170 | #endif | ||
2119 | if ((GNUNET_CRYPTO_rsa_decrypt (my_private_key, | 2171 | if ((GNUNET_CRYPTO_rsa_decrypt (my_private_key, |
2120 | &m->encrypted_key, | 2172 | &m->encrypted_key, |
2121 | &k, | 2173 | &k, |
@@ -2141,8 +2193,10 @@ handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m) | |||
2141 | { | 2193 | { |
2142 | case PEER_STATE_DOWN: | 2194 | case PEER_STATE_DOWN: |
2143 | n->status = PEER_STATE_KEY_RECEIVED; | 2195 | n->status = PEER_STATE_KEY_RECEIVED; |
2196 | #if DEBUG_CORE | ||
2144 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2197 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2145 | "Responding to `%s' with my own key.\n", "SET_KEY"); | 2198 | "Responding to `%s' with my own key.\n", "SET_KEY"); |
2199 | #endif | ||
2146 | send_key (n); | 2200 | send_key (n); |
2147 | break; | 2201 | break; |
2148 | case PEER_STATE_KEY_SENT: | 2202 | case PEER_STATE_KEY_SENT: |
@@ -2151,9 +2205,11 @@ handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m) | |||
2151 | if ((sender_status != PEER_STATE_KEY_RECEIVED) && | 2205 | if ((sender_status != PEER_STATE_KEY_RECEIVED) && |
2152 | (sender_status != PEER_STATE_KEY_CONFIRMED)) | 2206 | (sender_status != PEER_STATE_KEY_CONFIRMED)) |
2153 | { | 2207 | { |
2208 | #if DEBUG_CORE | ||
2154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2155 | "Responding to `%s' with my own key (other peer has status %u).\n", | 2210 | "Responding to `%s' with my own key (other peer has status %u).\n", |
2156 | "SET_KEY", sender_status); | 2211 | "SET_KEY", sender_status); |
2212 | #endif | ||
2157 | send_key (n); | 2213 | send_key (n); |
2158 | } | 2214 | } |
2159 | break; | 2215 | break; |
@@ -2161,9 +2217,11 @@ handle_set_key (struct Neighbour *n, const struct SetKeyMessage *m) | |||
2161 | if ((sender_status != PEER_STATE_KEY_RECEIVED) && | 2217 | if ((sender_status != PEER_STATE_KEY_RECEIVED) && |
2162 | (sender_status != PEER_STATE_KEY_CONFIRMED)) | 2218 | (sender_status != PEER_STATE_KEY_CONFIRMED)) |
2163 | { | 2219 | { |
2220 | #if DEBUG_CORE | ||
2164 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2165 | "Responding to `%s' with my own key (other peer has status %u), I was already fully up.\n", | 2222 | "Responding to `%s' with my own key (other peer has status %u), I was already fully up.\n", |
2166 | "SET_KEY", sender_status); | 2223 | "SET_KEY", sender_status); |
2224 | #endif | ||
2167 | send_key (n); | 2225 | send_key (n); |
2168 | } | 2226 | } |
2169 | break; | 2227 | break; |
@@ -2193,9 +2251,11 @@ handle_pong (struct Neighbour *n, const struct PingMessage *m) | |||
2193 | { | 2251 | { |
2194 | struct PingMessage t; | 2252 | struct PingMessage t; |
2195 | 2253 | ||
2254 | #if DEBUG_CORE | ||
2196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2255 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2197 | "Core service receives `%s' request from `%4s'.\n", | 2256 | "Core service receives `%s' request from `%4s'.\n", |
2198 | "PONG", GNUNET_i2s (&n->peer)); | 2257 | "PONG", GNUNET_i2s (&n->peer)); |
2258 | #endif | ||
2199 | if (GNUNET_OK != | 2259 | if (GNUNET_OK != |
2200 | do_decrypt (n, | 2260 | do_decrypt (n, |
2201 | &n->peer.hashPubKey, | 2261 | &n->peer.hashPubKey, |
@@ -2204,23 +2264,27 @@ handle_pong (struct Neighbour *n, const struct PingMessage *m) | |||
2204 | sizeof (struct PingMessage) - | 2264 | sizeof (struct PingMessage) - |
2205 | sizeof (struct GNUNET_MessageHeader))) | 2265 | sizeof (struct GNUNET_MessageHeader))) |
2206 | return; | 2266 | return; |
2267 | #if DEBUG_CORE | ||
2207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2268 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2208 | "Decrypted `%s' from `%4s' with challenge %u using key %u\n", | 2269 | "Decrypted `%s' from `%4s' with challenge %u using key %u\n", |
2209 | "PONG", | 2270 | "PONG", |
2210 | GNUNET_i2s (&t.target), | 2271 | GNUNET_i2s (&t.target), |
2211 | ntohl (t.challenge), n->decrypt_key.crc32); | 2272 | ntohl (t.challenge), n->decrypt_key.crc32); |
2273 | #endif | ||
2212 | if ((0 != memcmp (&t.target, | 2274 | if ((0 != memcmp (&t.target, |
2213 | &n->peer, | 2275 | &n->peer, |
2214 | sizeof (struct GNUNET_PeerIdentity))) || | 2276 | sizeof (struct GNUNET_PeerIdentity))) || |
2215 | (n->ping_challenge != ntohl (t.challenge))) | 2277 | (n->ping_challenge != ntohl (t.challenge))) |
2216 | { | 2278 | { |
2217 | /* PONG malformed */ | 2279 | /* PONG malformed */ |
2280 | #if DEBUG_CORE | ||
2218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2281 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2219 | "Received malfromed `%s' wanted sender `%4s' with challenge %u\n", | 2282 | "Received malfromed `%s' wanted sender `%4s' with challenge %u\n", |
2220 | "PONG", GNUNET_i2s (&n->peer), n->ping_challenge); | 2283 | "PONG", GNUNET_i2s (&n->peer), n->ping_challenge); |
2221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2284 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2222 | "Received malfromed `%s' received from `%4s' with challenge %u\n", | 2285 | "Received malfromed `%s' received from `%4s' with challenge %u\n", |
2223 | "PONG", GNUNET_i2s (&t.target), ntohl (t.challenge)); | 2286 | "PONG", GNUNET_i2s (&t.target), ntohl (t.challenge)); |
2287 | #endif | ||
2224 | GNUNET_break_op (0); | 2288 | GNUNET_break_op (0); |
2225 | return; | 2289 | return; |
2226 | } | 2290 | } |
@@ -2267,10 +2331,12 @@ send_p2p_message_to_client (struct Neighbour *sender, | |||
2267 | char buf[msize + sizeof (struct NotifyTrafficMessage)]; | 2331 | char buf[msize + sizeof (struct NotifyTrafficMessage)]; |
2268 | struct NotifyTrafficMessage *ntm; | 2332 | struct NotifyTrafficMessage *ntm; |
2269 | 2333 | ||
2334 | #if DEBUG_CORE | ||
2270 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2335 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2271 | "Core service passes message from `%4s' of type %u to client.\n", | 2336 | "Core service passes message from `%4s' of type %u to client.\n", |
2272 | GNUNET_i2s(&sender->peer), | 2337 | GNUNET_i2s(&sender->peer), |
2273 | ntohs (((const struct GNUNET_MessageHeader *) m)->type)); | 2338 | ntohs (((const struct GNUNET_MessageHeader *) m)->type)); |
2339 | #endif | ||
2274 | ntm = (struct NotifyTrafficMessage *) buf; | 2340 | ntm = (struct NotifyTrafficMessage *) buf; |
2275 | ntm->header.size = htons (msize + sizeof (struct NotifyTrafficMessage)); | 2341 | ntm->header.size = htons (msize + sizeof (struct NotifyTrafficMessage)); |
2276 | ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND); | 2342 | ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND); |
@@ -2412,9 +2478,11 @@ handle_encrypted_message (struct Neighbour *n, | |||
2412 | uint32_t snum; | 2478 | uint32_t snum; |
2413 | struct GNUNET_TIME_Absolute t; | 2479 | struct GNUNET_TIME_Absolute t; |
2414 | 2480 | ||
2481 | #if DEBUG_CORE | ||
2415 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2482 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2416 | "Core service receives `%s' request from `%4s'.\n", | 2483 | "Core service receives `%s' request from `%4s'.\n", |
2417 | "ENCRYPTED_MESSAGE", GNUNET_i2s (&n->peer)); | 2484 | "ENCRYPTED_MESSAGE", GNUNET_i2s (&n->peer)); |
2485 | #endif | ||
2418 | /* decrypt */ | 2486 | /* decrypt */ |
2419 | if (GNUNET_OK != | 2487 | if (GNUNET_OK != |
2420 | do_decrypt (n, | 2488 | do_decrypt (n, |
@@ -2512,9 +2580,11 @@ handle_transport_receive (void *cls, | |||
2512 | uint16_t type; | 2580 | uint16_t type; |
2513 | uint16_t size; | 2581 | uint16_t size; |
2514 | 2582 | ||
2583 | #if DEBUG_CORE | ||
2515 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2584 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2516 | "Received message of type %u from `%4s', demultiplexing.\n", | 2585 | "Received message of type %u from `%4s', demultiplexing.\n", |
2517 | ntohs (message->type), GNUNET_i2s (peer)); | 2586 | ntohs (message->type), GNUNET_i2s (peer)); |
2587 | #endif | ||
2518 | n = find_neighbour (peer); | 2588 | n = find_neighbour (peer); |
2519 | if (n == NULL) | 2589 | if (n == NULL) |
2520 | { | 2590 | { |
@@ -2559,9 +2629,11 @@ handle_transport_receive (void *cls, | |||
2559 | if ((n->status != PEER_STATE_KEY_RECEIVED) && | 2629 | if ((n->status != PEER_STATE_KEY_RECEIVED) && |
2560 | (n->status != PEER_STATE_KEY_CONFIRMED)) | 2630 | (n->status != PEER_STATE_KEY_CONFIRMED)) |
2561 | { | 2631 | { |
2632 | #if DEBUG_CORE | ||
2562 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2633 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2563 | "Core service receives `%s' request from `%4s' but have not processed key; marking as pending.\n", | 2634 | "Core service receives `%s' request from `%4s' but have not processed key; marking as pending.\n", |
2564 | "PING", GNUNET_i2s (&n->peer)); | 2635 | "PING", GNUNET_i2s (&n->peer)); |
2636 | #endif | ||
2565 | GNUNET_free_non_null (n->pending_ping); | 2637 | GNUNET_free_non_null (n->pending_ping); |
2566 | n->pending_ping = GNUNET_malloc (sizeof (struct PingMessage)); | 2638 | n->pending_ping = GNUNET_malloc (sizeof (struct PingMessage)); |
2567 | memcpy (n->pending_ping, message, sizeof (struct PingMessage)); | 2639 | memcpy (n->pending_ping, message, sizeof (struct PingMessage)); |
@@ -2641,9 +2713,11 @@ handle_transport_notify_connect (void *cls, | |||
2641 | n->bpm_out_external_limit = DEFAULT_BPM_IN_OUT; | 2713 | n->bpm_out_external_limit = DEFAULT_BPM_IN_OUT; |
2642 | n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 2714 | n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
2643 | (uint32_t) - 1); | 2715 | (uint32_t) - 1); |
2716 | #if DEBUG_CORE | ||
2644 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2717 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2645 | "Received connection from `%4s'.\n", | 2718 | "Received connection from `%4s'.\n", |
2646 | GNUNET_i2s (&n->peer)); | 2719 | GNUNET_i2s (&n->peer)); |
2720 | #endif | ||
2647 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); | 2721 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); |
2648 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); | 2722 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); |
2649 | cnm.bpm_available = htonl (DEFAULT_BPM_IN_OUT); | 2723 | cnm.bpm_available = htonl (DEFAULT_BPM_IN_OUT); |
@@ -2700,8 +2774,10 @@ handle_transport_notify_disconnect (void *cls, | |||
2700 | struct Neighbour *n; | 2774 | struct Neighbour *n; |
2701 | struct Neighbour *p; | 2775 | struct Neighbour *p; |
2702 | 2776 | ||
2777 | #if DEBUG_CORE | ||
2703 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2778 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2704 | "Peer `%4s' disconnected from us.\n", GNUNET_i2s (peer)); | 2779 | "Peer `%4s' disconnected from us.\n", GNUNET_i2s (peer)); |
2780 | #endif | ||
2705 | p = NULL; | 2781 | p = NULL; |
2706 | n = neighbours; | 2782 | n = neighbours; |
2707 | while ((n != NULL) && | 2783 | while ((n != NULL) && |
@@ -2736,11 +2812,20 @@ handle_transport_notify_disconnect (void *cls, | |||
2736 | static void | 2812 | static void |
2737 | cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 2813 | cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
2738 | { | 2814 | { |
2815 | struct Neighbour *n; | ||
2816 | |||
2817 | #if DEBUG_CORE | ||
2739 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2818 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2740 | "Core service shutting down.\n"); | 2819 | "Core service shutting down.\n"); |
2820 | #endif | ||
2741 | GNUNET_assert (transport != NULL); | 2821 | GNUNET_assert (transport != NULL); |
2742 | GNUNET_TRANSPORT_disconnect (transport); | 2822 | GNUNET_TRANSPORT_disconnect (transport); |
2743 | transport = NULL; | 2823 | transport = NULL; |
2824 | while (NULL != (n = neighbours)) | ||
2825 | { | ||
2826 | neighbours = n->next; | ||
2827 | free_neighbour (n); | ||
2828 | } | ||
2744 | } | 2829 | } |
2745 | 2830 | ||
2746 | 2831 | ||
@@ -2837,15 +2922,10 @@ run (void *cls, | |||
2837 | static void | 2922 | static void |
2838 | cleanup (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg) | 2923 | cleanup (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg) |
2839 | { | 2924 | { |
2840 | struct Neighbour *n; | 2925 | |
2841 | 2926 | ||
2842 | if (my_private_key != NULL) | 2927 | if (my_private_key != NULL) |
2843 | GNUNET_CRYPTO_rsa_key_free (my_private_key); | 2928 | GNUNET_CRYPTO_rsa_key_free (my_private_key); |
2844 | while (NULL != (n = neighbours)) | ||
2845 | { | ||
2846 | neighbours = n->next; | ||
2847 | free_neighbour (n); | ||
2848 | } | ||
2849 | /* | 2929 | /* |
2850 | FIXME: | 2930 | FIXME: |
2851 | - free clients | 2931 | - free clients |
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 1151f3ebb..d52b24a4f 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "gnunet_scheduler_lib.h" | 34 | #include "gnunet_scheduler_lib.h" |
35 | #include "gnunet_transport_service.h" | 35 | #include "gnunet_transport_service.h" |
36 | 36 | ||
37 | #define VERBOSE GNUNET_YES | 37 | #define VERBOSE GNUNET_NO |
38 | 38 | ||
39 | #define START_ARM GNUNET_YES | 39 | #define START_ARM GNUNET_YES |
40 | 40 | ||
@@ -339,7 +339,7 @@ check () | |||
339 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 339 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
340 | GNUNET_GETOPT_OPTION_END | 340 | GNUNET_GETOPT_OPTION_END |
341 | }; | 341 | }; |
342 | sleep (1); | 342 | // sleep (1); /* for 'make check': allow previous processes to fully terminate */ |
343 | ok = 1; | 343 | ok = 1; |
344 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 344 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, |
345 | argv, "test-core-api", "nohelp", options, &run, &ok); | 345 | argv, "test-core-api", "nohelp", options, &run, &ok); |
diff --git a/src/core/test_core_api_peer1.conf b/src/core/test_core_api_peer1.conf index 3c7020688..12251cb6a 100644 --- a/src/core/test_core_api_peer1.conf +++ b/src/core/test_core_api_peer1.conf | |||
@@ -9,9 +9,10 @@ PORT = 12464 | |||
9 | [transport] | 9 | [transport] |
10 | PORT = 12465 | 10 | PORT = 12465 |
11 | PLUGINS = tcp | 11 | PLUGINS = tcp |
12 | PREFIX = xterm -T transport1 -e | 12 | #PREFIX = xterm -T transport1 -e |
13 | #PREFIX = xterm -T transport1 -e gdb -x cmd --args | ||
13 | #PREFIX = xterm -T transport1 -e valgrind --tool=memcheck | 14 | #PREFIX = xterm -T transport1 -e valgrind --tool=memcheck |
14 | DEBUG = YES | 15 | #DEBUG = YES |
15 | 16 | ||
16 | [arm] | 17 | [arm] |
17 | PORT = 12466 | 18 | PORT = 12466 |
@@ -32,9 +33,10 @@ PORT = 12469 | |||
32 | [core] | 33 | [core] |
33 | PORT = 12470 | 34 | PORT = 12470 |
34 | #PREFIX = xterm -T core1 -e valgrind --tool=memcheck | 35 | #PREFIX = xterm -T core1 -e valgrind --tool=memcheck |
36 | #OPTIONS = -l log-core-1 | ||
35 | #PREFIX = xterm -T core1 -e gdb -x cmd --args | 37 | #PREFIX = xterm -T core1 -e gdb -x cmd --args |
36 | PREFIX = xterm -T core1 -e | 38 | #PREFIX = xterm -T core1 -e |
37 | DEBUG = YES | 39 | #DEBUG = YES |
38 | 40 | ||
39 | [testing] | 41 | [testing] |
40 | WEAKRANDOM = YES | 42 | WEAKRANDOM = YES |
diff --git a/src/core/test_core_api_peer2.conf b/src/core/test_core_api_peer2.conf index 2e994d27a..e3862da0f 100644 --- a/src/core/test_core_api_peer2.conf +++ b/src/core/test_core_api_peer2.conf | |||
@@ -9,9 +9,9 @@ PORT = 22464 | |||
9 | [transport] | 9 | [transport] |
10 | PORT = 22465 | 10 | PORT = 22465 |
11 | PLUGINS = tcp | 11 | PLUGINS = tcp |
12 | PREFIX = xterm -T transport2 -e | 12 | #PREFIX = xterm -T transport2 -e |
13 | #PREFIX = xterm -T transport2 -e valgrind --tool=memcheck | 13 | #PREFIX = xterm -T transport2 -e valgrind --tool=memcheck |
14 | DEBUG = YES | 14 | #DEBUG = YES |
15 | 15 | ||
16 | [arm] | 16 | [arm] |
17 | PORT = 22466 | 17 | PORT = 22466 |
@@ -31,9 +31,9 @@ PORT = 22469 | |||
31 | 31 | ||
32 | [core] | 32 | [core] |
33 | PORT = 22470 | 33 | PORT = 22470 |
34 | PREFIX = xterm -T core2 -e | 34 | #PREFIX = xterm -T core2 -e |
35 | #PREFIX = xterm -T core2 -e valgrind --tool=memcheck | 35 | #PREFIX = xterm -T core2 -e valgrind --tool=memcheck |
36 | DEBUG = YES | 36 | #DEBUG = YES |
37 | 37 | ||
38 | [testing] | 38 | [testing] |
39 | WEAKRANDOM = YES | 39 | WEAKRANDOM = YES |