avoid pk operation unless logging enabled
authorChristian Grothoff <christian@grothoff.org>
Fri, 21 Jun 2019 22:45:03 +0000 (00:45 +0200)
committerChristian Grothoff <christian@grothoff.org>
Fri, 21 Jun 2019 22:45:07 +0000 (00:45 +0200)
src/namestore/gnunet-service-namestore.c

index d2a09087e651173af23dec9e916c48e6f37c482a..1de3a3edf3571c8eb0f2c12fec91b4fc012c0b3c 100644 (file)
@@ -615,10 +615,22 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone)
   if ( (GNUNET_OK != res) ||
        (NULL == nick) )
   {
-    GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
-                "No nick name set for zone `%s'\n",
-                GNUNET_GNSRECORD_z2s (&pub));
+    static int do_log = GNUNET_LOG_CALL_STATUS;
+
+    if (0 == do_log)
+      do_log
+       = GNUNET_get_log_call_status (GNUNET_ERROR_TYPE_DEBUG,
+                                     "namestore",
+                                     __FILE__,
+                                     __FUNCTION__,
+                                     __LINE__);
+    if (1 == do_log)
+    {
+      GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
+                 "No nick name set for zone `%s'\n",
+                 GNUNET_GNSRECORD_z2s (&pub));
+    }
     return NULL;
   }