fixes
authorChristian Grothoff <christian@grothoff.org>
Tue, 11 Oct 2011 11:35:20 +0000 (11:35 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 11 Oct 2011 11:35:20 +0000 (11:35 +0000)
src/core/gnunet-service-core_sessions.c

index 360b558e4f35da92f6c4651aca072ed0892704e2..ab83532c08e05ae3a261f19070e0153a0e995f08 100644 (file)
@@ -484,12 +484,15 @@ try_transmission (struct Session *session)
     size_t used;
 
     used = 0;
-    pos = session->sme_head;
-    while ( (NULL != pos) &&
+    while ( (NULL != (pos = session->sme_head)) &&
            (used + pos->size <= msize) )
     {
       memcpy (&pbuf[used], &pos[1], pos->size);
       used += pos->size;
+      GNUNET_CONTAINER_DLL_remove (session->sme_head,
+                                  session->sme_tail,
+                                  pos);      
+      GNUNET_free (pos);
     }
     /* compute average payload size */
     total_bytes += used;
@@ -737,7 +740,10 @@ GSC_SESSIONS_add_to_typemap (const struct GNUNET_PeerIdentity *peer,
   struct Session *session;
   struct GSC_TypeMap *nmap;
 
+  if (0 == memcmp (peer, &GSC_my_identity, sizeof (struct GNUNET_PeerIdentity)))
+    return;
   session = find_session (peer);
+  GNUNET_assert (NULL != session);
   if (GNUNET_YES ==
       GSC_TYPEMAP_test_match (session->tmap,
                              &type, 1))