minior fix in test code
authort3sserakt <t3ss@posteo.de>
Wed, 8 Jan 2020 19:59:21 +0000 (20:59 +0100)
committert3sserakt <t3ss@posteo.de>
Wed, 8 Jan 2020 19:59:21 +0000 (20:59 +0100)
src/cadet/gnunet-service-cadet_tunnels.c
src/cadet/test_cadet.c

index 639b4956fe4d6e40934dc5013b196e1c11ddda8c..b017624c49e15cce8040e81e74ecf8b3e8c904a1 100644 (file)
@@ -3484,7 +3484,7 @@ GCT_send (struct CadetTunnel *t,
   {
     ch = lookup_channel (t,
                          *ctn);
-    if (GCCH_is_type_to_drop(ch, message))
+    if (NULL != ch && GCCH_is_type_to_drop(ch, message))
     {
       GNUNET_break(0);
       return NULL;
index 4b7c16ec528c9cf2ff5af67dbed5b91e9a64d4b2..3e7dcbb0aca1a5a5931ad49131cbd8f54c76abf4 100644 (file)
@@ -551,6 +551,18 @@ get_from_cadets()
   
 }
 
+static unsigned int
+get_peer_nr()
+{
+  if (0 < GNUNET_memcmp (p_id[0], p_id[1]))
+  {
+    return peers_running - 1;
+  }else
+  {
+     return 0;
+  }
+}
+
 /**
  * Task to reconnect to other peer.
  *
@@ -969,7 +981,7 @@ connect_handler (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               " ok: %d\n",
               ok);
-  if (peer == peers_requested - 1)
+  if (peer == get_peer_nr())
   {
     if (NULL != incoming_ch)
     {