aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-20 14:54:49 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-20 14:54:49 +0000
commit4c630a158187a48ba585167b0ede49bd524d6f8d (patch)
treece1c39ef45e87f31ebb56d38c7d0e9038811e85b /src/transport/gnunet-transport.c
parentf71fb2816cee37e823abcaa9d79c149ba90ff4cd (diff)
downloadgnunet-4c630a158187a48ba585167b0ede49bd524d6f8d.tar.gz
gnunet-4c630a158187a48ba585167b0ede49bd524d6f8d.zip
-use separate message types for TRY_CONNECT and TRY_DISCONNECT
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 7adbf4c32..cd74abde7 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -281,11 +281,16 @@ static struct GNUNET_TRANSPORT_Handle *handle;
281static struct GNUNET_CONFIGURATION_Handle *cfg; 281static struct GNUNET_CONFIGURATION_Handle *cfg;
282 282
283/** 283/**
284 * Try_connect handle 284 * Try connect handle
285 */ 285 */
286struct GNUNET_TRANSPORT_TryConnectHandle *tc_handle; 286struct GNUNET_TRANSPORT_TryConnectHandle *tc_handle;
287 287
288/** 288/**
289 * Try disconnect handle
290 */
291struct GNUNET_TRANSPORT_TryDisconnectHandle *td_handle;
292
293/**
289 * Option -s. 294 * Option -s.
290 */ 295 */
291static int benchmark_send; 296static int benchmark_send;
@@ -1772,11 +1777,9 @@ try_connect_cb (void *cls,
1772{ 1777{
1773 static int retries = 0; 1778 static int retries = 0;
1774 1779
1780 tc_handle = NULL;
1775 if (GNUNET_OK == result) 1781 if (GNUNET_OK == result)
1776 {
1777 tc_handle = NULL;
1778 return; 1782 return;
1779 }
1780 retries++; 1783 retries++;
1781 if (retries < 10) 1784 if (retries < 10)
1782 { 1785 {
@@ -1784,18 +1787,15 @@ try_connect_cb (void *cls,
1784 &pid, 1787 &pid,
1785 &try_connect_cb, 1788 &try_connect_cb,
1786 NULL); 1789 NULL);
1787 }
1788 else
1789 {
1790 FPRINTF (stderr,
1791 "%s",
1792 _("Failed to send connect request to transport service\n"));
1793 if (GNUNET_SCHEDULER_NO_TASK != end)
1794 GNUNET_SCHEDULER_cancel (end);
1795 ret = 1;
1796 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1797 return; 1790 return;
1798 } 1791 }
1792 FPRINTF (stderr,
1793 "%s",
1794 _("Failed to send connect request to transport service\n"));
1795 if (GNUNET_SCHEDULER_NO_TASK != end)
1796 GNUNET_SCHEDULER_cancel (end);
1797 ret = 1;
1798 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1799} 1799}
1800 1800
1801 1801
@@ -1812,27 +1812,25 @@ try_disconnect_cb (void *cls,
1812 const int result) 1812 const int result)
1813{ 1813{
1814 static int retries = 0; 1814 static int retries = 0;
1815
1816 td_handle = NULL;
1815 if (GNUNET_OK == result) 1817 if (GNUNET_OK == result)
1816 {
1817 tc_handle = NULL;
1818 return; 1818 return;
1819 }
1820 retries++; 1819 retries++;
1821 if (retries < 10) 1820 if (retries < 10)
1822 tc_handle = GNUNET_TRANSPORT_try_disconnect (handle, 1821 {
1822 td_handle = GNUNET_TRANSPORT_try_disconnect (handle,
1823 &pid, 1823 &pid,
1824 &try_disconnect_cb, 1824 &try_disconnect_cb,
1825 NULL); 1825 NULL);
1826 else
1827 {
1828 FPRINTF (stderr, "%s",
1829 _("Failed to send disconnect request to transport service\n"));
1830 if (GNUNET_SCHEDULER_NO_TASK != end)
1831 GNUNET_SCHEDULER_cancel (end);
1832 ret = 1;
1833 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1834 return; 1826 return;
1835 } 1827 }
1828 FPRINTF (stderr, "%s",
1829 _("Failed to send disconnect request to transport service\n"));
1830 if (GNUNET_SCHEDULER_NO_TASK != end)
1831 GNUNET_SCHEDULER_cancel (end);
1832 ret = 1;
1833 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1836} 1834}
1837 1835
1838 1836
@@ -1933,9 +1931,10 @@ testservice_task (void *cls,
1933 ret = 1; 1931 ret = 1;
1934 return; 1932 return;
1935 } 1933 }
1936 tc_handle = GNUNET_TRANSPORT_try_disconnect (handle, &pid, try_disconnect_cb, 1934 td_handle = GNUNET_TRANSPORT_try_disconnect (handle, &pid,
1937 NULL); 1935 &try_disconnect_cb,
1938 if (NULL == tc_handle) 1936 NULL);
1937 if (NULL == td_handle)
1939 { 1938 {
1940 FPRINTF (stderr, "%s", 1939 FPRINTF (stderr, "%s",
1941 _("Failed to send request to transport service\n")); 1940 _("Failed to send request to transport service\n"));