more assertions
authorChristian Grothoff <christian@grothoff.org>
Mon, 17 Oct 2011 20:08:14 +0000 (20:08 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 17 Oct 2011 20:08:14 +0000 (20:08 +0000)
src/transport/plugin_transport_tcp.c

index 7c724f532f99dfd7c417bd8741e03442d3ae1197..e2fc413ea342eef09fea669841f8d8a9c8f30653 100644 (file)
@@ -1127,6 +1127,18 @@ tcp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
     /* check if session is valid */
     struct Session *ses = plugin->sessions;
 
+    if (0 != memcmp (target,
+                    &session->target,
+                    sizeof (struct GNUNET_PeerIdentity)))
+    {
+      GNUNET_break (0);
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                 "Got session for `%s', but should be for peer `%s'!\n",
+                 GNUNET_i2s (&session->target),
+                 GNUNET_h2s (&target->hashPubKey));
+      return -1;
+    }
+
     while ((ses != NULL) && (ses != session))
       ses = ses->next;
     if (ses == NULL)