diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-11-23 20:37:14 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-11-23 20:37:14 +0000 |
commit | 7e60f24441ae84fe5aa965a09805e25996423886 (patch) | |
tree | 07bc7f0efd53a08db93082a85011a6a0c7bcac56 /src/transport/gnunet-transport.c | |
parent | 353a1b1b3d482863aec041449ec4eea6f8a97885 (diff) | |
download | gnunet-7e60f24441ae84fe5aa965a09805e25996423886.tar.gz gnunet-7e60f24441ae84fe5aa965a09805e25996423886.zip |
-fix docs, fix shutdown
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r-- | src/transport/gnunet-transport.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 4b1e683f6..646b8087b 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -1599,18 +1599,30 @@ plugin_monitoring_cb (void *cls, | |||
1599 | const char *state; | 1599 | const char *state; |
1600 | struct PluginMonitorAddress *addr; | 1600 | struct PluginMonitorAddress *addr; |
1601 | 1601 | ||
1602 | fprintf (stderr, "E!\n"); | ||
1603 | if ( (NULL == info) && | 1602 | if ( (NULL == info) && |
1604 | (NULL == session) ) | 1603 | (NULL == session) ) |
1605 | return; /* in sync with transport service */ | 1604 | return; /* in sync with transport service */ |
1605 | addr = *session_ctx; | ||
1606 | if (NULL == info) | 1606 | if (NULL == info) |
1607 | { | ||
1608 | if (NULL != addr) | ||
1609 | { | ||
1610 | if (NULL != addr->asc) | ||
1611 | { | ||
1612 | GNUNET_TRANSPORT_address_to_string_cancel (addr->asc); | ||
1613 | addr->asc = NULL; | ||
1614 | } | ||
1615 | GNUNET_free_non_null (addr->str); | ||
1616 | GNUNET_free (addr); | ||
1617 | *session_ctx = NULL; | ||
1618 | } | ||
1607 | return; /* shutdown */ | 1619 | return; /* shutdown */ |
1620 | } | ||
1608 | if ( (NULL != cpid) && | 1621 | if ( (NULL != cpid) && |
1609 | (0 != memcmp (&info->address->peer, | 1622 | (0 != memcmp (&info->address->peer, |
1610 | cpid, | 1623 | cpid, |
1611 | sizeof (struct GNUNET_PeerIdentity))) ) | 1624 | sizeof (struct GNUNET_PeerIdentity))) ) |
1612 | return; /* filtered */ | 1625 | return; /* filtered */ |
1613 | addr = *session_ctx; | ||
1614 | if (NULL == addr) | 1626 | if (NULL == addr) |
1615 | { | 1627 | { |
1616 | addr = GNUNET_new (struct PluginMonitorAddress); | 1628 | addr = GNUNET_new (struct PluginMonitorAddress); |
@@ -1747,8 +1759,8 @@ process_peer_monitoring_cb (void *cls, | |||
1747 | 1759 | ||
1748 | 1760 | ||
1749 | /** | 1761 | /** |
1750 | * Function called with our result of trying to connect to the | 1762 | * Function called with our result of trying to connect to a peer |
1751 | * transport service. Will retry 10 times, and if we still | 1763 | * using the transport service. Will retry 10 times, and if we still |
1752 | * fail to connect terminate with an error message. | 1764 | * fail to connect terminate with an error message. |
1753 | * | 1765 | * |
1754 | * @param cls NULL | 1766 | * @param cls NULL |
@@ -1787,6 +1799,14 @@ try_connect_cb (void *cls, | |||
1787 | } | 1799 | } |
1788 | 1800 | ||
1789 | 1801 | ||
1802 | /** | ||
1803 | * Function called with our result of trying to disconnect a peer | ||
1804 | * using the transport service. Will retry 10 times, and if we still | ||
1805 | * fail to disconnect, terminate with an error message. | ||
1806 | * | ||
1807 | * @param cls NULL | ||
1808 | * @param result #GNUNET_OK if we connected to the service | ||
1809 | */ | ||
1790 | static void | 1810 | static void |
1791 | try_disconnect_cb (void *cls, | 1811 | try_disconnect_cb (void *cls, |
1792 | const int result) | 1812 | const int result) |
@@ -1799,12 +1819,14 @@ try_disconnect_cb (void *cls, | |||
1799 | } | 1819 | } |
1800 | retries++; | 1820 | retries++; |
1801 | if (retries < 10) | 1821 | if (retries < 10) |
1802 | tc_handle = GNUNET_TRANSPORT_try_disconnect (handle, &pid, try_disconnect_cb, | 1822 | tc_handle = GNUNET_TRANSPORT_try_disconnect (handle, |
1803 | NULL); | 1823 | &pid, |
1824 | &try_disconnect_cb, | ||
1825 | NULL); | ||
1804 | else | 1826 | else |
1805 | { | 1827 | { |
1806 | FPRINTF (stderr, "%s", | 1828 | FPRINTF (stderr, "%s", |
1807 | _("Failed to send connect request to transport service\n")); | 1829 | _("Failed to send disconnect request to transport service\n")); |
1808 | if (GNUNET_SCHEDULER_NO_TASK != end) | 1830 | if (GNUNET_SCHEDULER_NO_TASK != end) |
1809 | GNUNET_SCHEDULER_cancel (end); | 1831 | GNUNET_SCHEDULER_cancel (end); |
1810 | ret = 1; | 1832 | ret = 1; |
@@ -1822,7 +1844,8 @@ try_disconnect_cb (void *cls, | |||
1822 | * @param result #GNUNET_YES if transport is running | 1844 | * @param result #GNUNET_YES if transport is running |
1823 | */ | 1845 | */ |
1824 | static void | 1846 | static void |
1825 | testservice_task (void *cls, int result) | 1847 | testservice_task (void *cls, |
1848 | int result) | ||
1826 | { | 1849 | { |
1827 | int counter = 0; | 1850 | int counter = 0; |
1828 | ret = 1; | 1851 | ret = 1; |