diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-21 05:33:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-21 05:33:35 +0000 |
commit | ea2e2343ed8fdb1544f94c31a98061fdea989975 (patch) | |
tree | 89c07368e17580bad6b7d6a76e2e98bd021e6523 /src/util | |
parent | 4bcb854976f9f86f3b05e519542015bc2f14d484 (diff) | |
download | gnunet-ea2e2343ed8fdb1544f94c31a98061fdea989975.tar.gz gnunet-ea2e2343ed8fdb1544f94c31a98061fdea989975.zip |
-fix misc minor bugs
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/client_new.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/src/util/client_new.c b/src/util/client_new.c index d2b70388c..1e90470fb 100644 --- a/src/util/client_new.c +++ b/src/util/client_new.c | |||
@@ -578,7 +578,7 @@ try_connect_using_address (void *cls, | |||
578 | { | 578 | { |
579 | struct ClientState *cstate = cls; | 579 | struct ClientState *cstate = cls; |
580 | struct AddressProbe *ap; | 580 | struct AddressProbe *ap; |
581 | 581 | ||
582 | if (NULL == addr) | 582 | if (NULL == addr) |
583 | { | 583 | { |
584 | cstate->dns_active = NULL; | 584 | cstate->dns_active = NULL; |
@@ -762,6 +762,8 @@ connection_client_send_impl (struct GNUNET_MQ_Handle *mq, | |||
762 | GNUNET_assert (NULL == cstate->send_task); | 762 | GNUNET_assert (NULL == cstate->send_task); |
763 | cstate->msg = msg; | 763 | cstate->msg = msg; |
764 | cstate->msg_off = 0; | 764 | cstate->msg_off = 0; |
765 | if (NULL == cstate->sock) | ||
766 | return; /* still waiting for connection */ | ||
765 | cstate->send_task | 767 | cstate->send_task |
766 | = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, | 768 | = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, |
767 | cstate->sock, | 769 | cstate->sock, |
@@ -785,8 +787,11 @@ connection_client_cancel_impl (struct GNUNET_MQ_Handle *mq, | |||
785 | GNUNET_assert (NULL != cstate->msg); | 787 | GNUNET_assert (NULL != cstate->msg); |
786 | GNUNET_assert (0 == cstate->msg_off); | 788 | GNUNET_assert (0 == cstate->msg_off); |
787 | cstate->msg = NULL; | 789 | cstate->msg = NULL; |
788 | GNUNET_SCHEDULER_cancel (cstate->send_task); | 790 | if (NULL != cstate->send_task) |
789 | cstate->send_task = NULL; | 791 | { |
792 | GNUNET_SCHEDULER_cancel (cstate->send_task); | ||
793 | cstate->send_task = NULL; | ||
794 | } | ||
790 | } | 795 | } |
791 | 796 | ||
792 | 797 | ||
@@ -826,36 +831,34 @@ GNUNET_CLIENT_connecT2 (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
826 | service_name, | 831 | service_name, |
827 | "PORT")) | 832 | "PORT")) |
828 | { | 833 | { |
829 | if (! (GNUNET_OK != | 834 | if (! ( (GNUNET_OK != |
830 | GNUNET_CONFIGURATION_get_value_number (cfg, | 835 | GNUNET_CONFIGURATION_get_value_number (cfg, |
831 | service_name, | 836 | service_name, |
832 | "PORT", | 837 | "PORT", |
833 | &cstate->port)) || | 838 | &cstate->port)) || |
834 | (cstate->port > 65535) || | 839 | (cstate->port > 65535) || |
835 | (GNUNET_OK != | 840 | (GNUNET_OK != |
836 | GNUNET_CONFIGURATION_get_value_string (cfg, | 841 | GNUNET_CONFIGURATION_get_value_string (cfg, |
837 | service_name, | 842 | service_name, |
838 | "HOSTNAME", | 843 | "HOSTNAME", |
839 | &cstate->hostname)) ) | 844 | &cstate->hostname)) ) && |
845 | (0 == strlen (cstate->hostname)) ) | ||
840 | { | 846 | { |
841 | if (0 == strlen (cstate->hostname)) | 847 | GNUNET_free (cstate->hostname); |
842 | { | 848 | cstate->hostname = NULL; |
843 | GNUNET_free (cstate->hostname); | 849 | LOG (GNUNET_ERROR_TYPE_WARNING, |
844 | cstate->hostname = NULL; | 850 | _("Need a non-empty hostname for service `%s'.\n"), |
845 | LOG (GNUNET_ERROR_TYPE_WARNING, | 851 | service_name); |
846 | _("Need a non-empty hostname for service `%s'.\n"), | ||
847 | service_name); | ||
848 | } | ||
849 | } | 852 | } |
850 | } | 853 | } |
851 | 854 | cstate->mq = GNUNET_MQ_queue_for_callbacks (&connection_client_send_impl, | |
852 | return GNUNET_MQ_queue_for_callbacks (&connection_client_send_impl, | 855 | &connection_client_destroy_impl, |
853 | &connection_client_destroy_impl, | 856 | &connection_client_cancel_impl, |
854 | &connection_client_cancel_impl, | 857 | cstate, |
855 | cstate, | 858 | handlers, |
856 | handlers, | 859 | error_handler, |
857 | error_handler, | 860 | error_handler_cls); |
858 | error_handler_cls); | 861 | return cstate->mq; |
859 | } | 862 | } |
860 | 863 | ||
861 | /* end of client_new.c */ | 864 | /* end of client_new.c */ |