- fix coverity
[oweals/gnunet.git] / src / cadet / gnunet-service-cadet_hello.c
index 9229483fee4ae099060c3c3196ed8324b987c9b6..3c63f3551b610bae1f881be64537b535aad7b563 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2014 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2014 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -108,7 +108,7 @@ got_hello (void *cls, const struct GNUNET_PeerIdentity *id,
   LOG (GNUNET_ERROR_TYPE_DEBUG, " hello for %s (%d bytes), expires on %s\n",
        GNUNET_i2s (id), GNUNET_HELLO_size (hello),
        GNUNET_STRINGS_absolute_time_to_string (GNUNET_HELLO_get_last_expiration(hello)));
-  peer = GCP_get (id);
+  peer = GCP_get (id, GNUNET_YES);
   GCP_set_hello (peer, hello);
 
   if (GCP_get_short_id (peer) == myid)
@@ -141,6 +141,7 @@ GCH_init (const struct GNUNET_CONFIGURATION_Handle *c)
 void
 GCH_shutdown ()
 {
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down channels\n");
   if (NULL != nc)
   {
     GNUNET_PEERINFO_notify_cancel (nc);
@@ -176,7 +177,12 @@ GCH_get_mine (void)
 const struct GNUNET_HELLO_Message *
 GCH_get (const struct GNUNET_PeerIdentity *id)
 {
-  return GCP_get_hello (GCP_get (id));
+  struct CadetPeer *p;
+
+  p = GCP_get (id, GNUNET_NO);
+  if (NULL == p)
+    return NULL;
+  return GCP_get_hello (p);
 }