gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37432 - gnunet/src/rps


From: gnunet
Subject: [GNUnet-SVN] r37432 - gnunet/src/rps
Date: Sat, 2 Jul 2016 01:38:32 +0200

Author: ch3
Date: 2016-07-02 01:38:31 +0200 (Sat, 02 Jul 2016)
New Revision: 37432

Modified:
   gnunet/src/rps/gnunet-service-rps_peers.c
Log:
-rps _peers: restructure of status check

Modified: gnunet/src/rps/gnunet-service-rps_peers.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps_peers.c   2016-07-01 23:38:27 UTC (rev 
37431)
+++ gnunet/src/rps/gnunet-service-rps_peers.c   2016-07-01 23:38:31 UTC (rev 
37432)
@@ -509,6 +509,7 @@
                                    GNUNET_RPS_CADET_PORT,
                                    GNUNET_CADET_OPTION_RELIABLE);
   }
+  GNUNET_assert (NULL != peer_ctx->send_channel);
   return peer_ctx->send_channel;
 }
 
@@ -597,24 +598,32 @@
        "Get informed about peer %s getting live\n",
        GNUNET_i2s (&peer_ctx->peer_id));
 
-  if (NULL == peer_ctx->transmit_handle &&
-      NULL == peer_ctx->send_channel)
+  if (NULL != peer_ctx->transmit_handle)
   {
-    (void) get_channel (&peer_ctx->peer_id);
-    peer_ctx->transmit_handle =
-        GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel,
-                                            GNUNET_NO,
-                                            GNUNET_TIME_UNIT_FOREVER_REL,
-                                            sizeof (struct 
GNUNET_MessageHeader),
-                                            cadet_notify_transmit_ready_cb,
-                                            peer_ctx);
-  }
-  else if (NULL != peer_ctx->transmit_handle)
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Already waiting for notification\n");
-  else if (NULL != peer_ctx->send_channel)
+    return;
+  }
+  if (NULL != peer_ctx->send_channel)
+  {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Already have established channel to peer\n");
+    return;
+  }
+  (void) get_channel (&peer_ctx->peer_id);
+  peer_ctx->transmit_handle =
+      GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel,
+                                          GNUNET_NO,
+                                          GNUNET_TIME_UNIT_FOREVER_REL,
+                                          sizeof (struct GNUNET_MessageHeader),
+                                          cadet_notify_transmit_ready_cb,
+                                          peer_ctx);
+  if (NULL == peer_ctx->transmit_handle)
+  {
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+        "Cadet was not able to queue the request (insufficient memory)\n");
+    GNUNET_break (0);
+  }
 }
 
 /**




reply via email to

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