aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index c44d5ef04..18b50b38a 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -753,6 +753,8 @@ transmit_to_client_callback (void *cls, size_t size, void *buf)
753 753
754 if (buf == NULL) 754 if (buf == NULL)
755 { 755 {
756 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
757 "Transmission to client failed, closing connection.\n");
756 /* fatal error with client, free message queue! */ 758 /* fatal error with client, free message queue! */
757 while (NULL != (q = client->message_queue_head)) 759 while (NULL != (q = client->message_queue_head))
758 { 760 {
@@ -927,9 +929,15 @@ transmit_send_continuation (void *cls,
927 GNUNET_assert (rl != NULL); 929 GNUNET_assert (rl != NULL);
928 } 930 }
929 if (result == GNUNET_OK) 931 if (result == GNUNET_OK)
930 rl->timeout = GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT); 932 {
933 rl->timeout = GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT);
934 }
931 else 935 else
932 rl->connected = GNUNET_NO; 936 {
937 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
938 "Transmission failed, marking connection as down.\n");
939 rl->connected = GNUNET_NO;
940 }
933 if (!mq->internal_msg) 941 if (!mq->internal_msg)
934 rl->transmit_ready = GNUNET_YES; 942 rl->transmit_ready = GNUNET_YES;
935 if (mq->client != NULL) 943 if (mq->client != NULL)
@@ -1389,7 +1397,8 @@ plugin_env_notify_address (void *cls,
1389 1397
1390#if DEBUG_TRANSPORT 1398#if DEBUG_TRANSPORT
1391 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1399 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1392 "Plugin `%s' informs us about a new address\n", name); 1400 "Plugin `%s' informs us about a new address `%s'\n", name,
1401 GNUNET_a2s(addr, addrlen));
1393#endif 1402#endif
1394 abex = GNUNET_TIME_relative_to_absolute (expires); 1403 abex = GNUNET_TIME_relative_to_absolute (expires);
1395 GNUNET_assert (p == find_transport (name)); 1404 GNUNET_assert (p == find_transport (name));
@@ -1618,7 +1627,7 @@ cleanup_validation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1618 else 1627 else
1619 pos = prev->next; 1628 pos = prev->next;
1620 continue; 1629 continue;
1621 } 1630 }
1622 prev = pos; 1631 prev = pos;
1623 pos = pos->next; 1632 pos = pos->next;
1624 } 1633 }
@@ -1654,6 +1663,7 @@ struct CheckHelloValidatedContext
1654 * Validation list being build. 1663 * Validation list being build.
1655 */ 1664 */
1656 struct ValidationList *e; 1665 struct ValidationList *e;
1666
1657}; 1667};
1658 1668
1659 1669
@@ -1671,6 +1681,7 @@ run_validation (void *cls,
1671 struct TransportPlugin *tp; 1681 struct TransportPlugin *tp;
1672 struct ValidationAddress *va; 1682 struct ValidationAddress *va;
1673 struct ValidationChallengeMessage *vcm; 1683 struct ValidationChallengeMessage *vcm;
1684 struct GNUNET_PeerIdentity id;
1674 1685
1675 tp = find_transport (tname); 1686 tp = find_transport (tname);
1676 if (tp == NULL) 1687 if (tp == NULL)
@@ -1682,6 +1693,16 @@ run_validation (void *cls,
1682 tname); 1693 tname);
1683 return GNUNET_OK; 1694 return GNUNET_OK;
1684 } 1695 }
1696 GNUNET_CRYPTO_hash (&e->publicKey,
1697 sizeof (struct
1698 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
1699 &id.hashPubKey);
1700 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1701 "Scheduling validation of address `%s' via `%s' for `%4s'\n",
1702 GNUNET_a2s(addr, addrlen),
1703 tname,
1704 GNUNET_i2s(&id));
1705
1685 va = GNUNET_malloc (sizeof (struct ValidationAddress) + 1706 va = GNUNET_malloc (sizeof (struct ValidationAddress) +
1686 sizeof (struct ValidationChallengeMessage) + addrlen); 1707 sizeof (struct ValidationChallengeMessage) + addrlen);
1687 va->next = e->addresses; 1708 va->next = e->addresses;
@@ -1699,7 +1720,7 @@ run_validation (void *cls,
1699 vcm->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_HELLO); 1720 vcm->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_HELLO);
1700 vcm->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1721 vcm->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
1701 (unsigned int) -1); 1722 (unsigned int) -1);
1702 /* Note: vcm->target is set in check_hello_validated */ 1723 vcm->target = id;
1703 memcpy (&vcm[1], addr, addrlen); 1724 memcpy (&vcm[1], addr, addrlen);
1704 return GNUNET_OK; 1725 return GNUNET_OK;
1705} 1726}
@@ -1752,10 +1773,6 @@ check_hello_validated (void *cls,
1752 va = chvc->e->addresses; 1773 va = chvc->e->addresses;
1753 while (va != NULL) 1774 while (va != NULL)
1754 { 1775 {
1755 GNUNET_CRYPTO_hash (&chvc->e->publicKey,
1756 sizeof (struct
1757 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
1758 &va->msg->target.hashPubKey);
1759#if DEBUG_TRANSPORT 1776#if DEBUG_TRANSPORT
1760 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1777 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1761 "Establishing `%s' connection to validate `%s' of `%4s' (sending our `%s')\n", 1778 "Establishing `%s' connection to validate `%s' of `%4s' (sending our `%s')\n",
@@ -1841,6 +1858,11 @@ process_hello (struct TransportPlugin *plugin,
1841 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) 1858 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)))
1842 { 1859 {
1843 /* TODO: call to stats? */ 1860 /* TODO: call to stats? */
1861#if DEBUG_TRANSPORT
1862 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1863 "`%s' message for peer `%4s' is already pending; ignoring new message\n",
1864 "HELLO", GNUNET_i2s (&target));
1865#endif
1844 return GNUNET_OK; 1866 return GNUNET_OK;
1845 } 1867 }
1846 e = e->next; 1868 e = e->next;