gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r38172 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r38172 - gnunet/src/util
Date: Fri, 21 Oct 2016 07:33:36 +0200

Author: grothoff
Date: 2016-10-21 07:33:35 +0200 (Fri, 21 Oct 2016)
New Revision: 38172

Modified:
   gnunet/src/util/client_new.c
Log:
-fix misc minor bugs

Modified: gnunet/src/util/client_new.c
===================================================================
--- gnunet/src/util/client_new.c        2016-10-21 05:23:21 UTC (rev 38171)
+++ gnunet/src/util/client_new.c        2016-10-21 05:33:35 UTC (rev 38172)
@@ -578,7 +578,7 @@
 {
   struct ClientState *cstate = cls;
   struct AddressProbe *ap;
-
+  
   if (NULL == addr)
   {
     cstate->dns_active = NULL;
@@ -762,6 +762,8 @@
   GNUNET_assert (NULL == cstate->send_task);
   cstate->msg = msg;
   cstate->msg_off = 0;
+  if (NULL == cstate->sock)
+    return; /* still waiting for connection */
   cstate->send_task
     = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
                                       cstate->sock,
@@ -785,8 +787,11 @@
   GNUNET_assert (NULL != cstate->msg);
   GNUNET_assert (0 == cstate->msg_off);
   cstate->msg = NULL;
-  GNUNET_SCHEDULER_cancel (cstate->send_task);
-  cstate->send_task = NULL;
+  if (NULL != cstate->send_task)
+  {
+    GNUNET_SCHEDULER_cancel (cstate->send_task);
+    cstate->send_task = NULL;
+  }
 }
 
 
@@ -826,36 +831,34 @@
                                        service_name,
                                        "PORT"))
   {
-    if (! (GNUNET_OK !=
-           GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                  service_name,
-                                                  "PORT",
-                                                  &cstate->port)) ||
-        (cstate->port > 65535) ||
-        (GNUNET_OK !=
-         GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                service_name,
-                                                "HOSTNAME",
-                                                &cstate->hostname)) )
+    if (! ( (GNUNET_OK !=
+            GNUNET_CONFIGURATION_get_value_number (cfg,
+                                                   service_name,
+                                                   "PORT",
+                                                   &cstate->port)) ||
+           (cstate->port > 65535) ||
+           (GNUNET_OK !=
+            GNUNET_CONFIGURATION_get_value_string (cfg,
+                                                   service_name,
+                                                   "HOSTNAME",
+                                                   &cstate->hostname)) ) &&
+       (0 == strlen (cstate->hostname)) )
     {
-      if (0 == strlen (cstate->hostname))
-      {
-        GNUNET_free (cstate->hostname);
-        cstate->hostname = NULL;
-        LOG (GNUNET_ERROR_TYPE_WARNING,
-             _("Need a non-empty hostname for service `%s'.\n"),
-             service_name);
-      }
+      GNUNET_free (cstate->hostname);
+      cstate->hostname = NULL;
+      LOG (GNUNET_ERROR_TYPE_WARNING,
+          _("Need a non-empty hostname for service `%s'.\n"),
+          service_name);
     }
   }
-
-  return GNUNET_MQ_queue_for_callbacks (&connection_client_send_impl,
-                                        &connection_client_destroy_impl,
-                                        &connection_client_cancel_impl,
-                                        cstate,
-                                        handlers,
-                                        error_handler,
-                                        error_handler_cls);
+  cstate->mq = GNUNET_MQ_queue_for_callbacks (&connection_client_send_impl,
+                                             &connection_client_destroy_impl,
+                                             &connection_client_cancel_impl,
+                                             cstate,
+                                             handlers,
+                                             error_handler,
+                                             error_handler_cls);
+  return cstate->mq;
 }
 
 /* end of client_new.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]