misc minor fixes
[oweals/gnunet.git] / src / core / gnunet-service-core_sessions.c
index b99fee272a5d6dc425994811c97526c37d884373..0a547be1b24ad5a201b0516964c8256de79f64ee 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009-2014 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009-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
@@ -264,11 +264,9 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid)
  * (Done periodically until the typemap is confirmed).
  *
  * @param cls the `struct Session *`
- * @param tc unused
  */
 static void
-transmit_typemap_task (void *cls,
-                       const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_typemap_task (void *cls)
 {
   struct Session *session = cls;
   struct GNUNET_MessageHeader *hdr;
@@ -575,6 +573,11 @@ solicit_messages (struct Session *session,
                 "Soliciting message with priority %u\n",
                 car->priority);
     GSC_CLIENTS_solicit_request (car);
+    /* The above call may *dequeue* requests and thereby
+       clobber 'nxt'. Hence we need to restart from the
+       head of the list. */
+    nxt = session->active_client_request_head;
+    so_size = msize;
   }
 }
 
@@ -584,11 +587,9 @@ solicit_messages (struct Session *session,
  * Send them now.
  *
  * @param cls `struct Session` with the messages to transmit now
- * @param tc scheduler context (unused)
  */
 static void
-pop_cork_task (void *cls,
-               const struct GNUNET_SCHEDULER_TaskContext *tc)
+pop_cork_task (void *cls)
 {
   struct Session *session = cls;
 
@@ -669,7 +670,8 @@ try_transmission (struct Session *session)
     {
       if (GNUNET_YES == car->was_solicited)
         continue;
-      maxpc = GNUNET_MAX (maxpc, car->priority);
+      maxpc = GNUNET_MAX (maxpc,
+                          car->priority);
     }
     if (maxpc > maxp)
     {
@@ -704,7 +706,7 @@ try_transmission (struct Session *session)
                 "Soliciting messages (excess %d, maxpc %d, message size %u, deadline %s)\n",
                 excess,
                 maxpc,
-                msize,
+                (unsigned int) msize,
                 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (min_deadline),
                                                         GNUNET_YES));
     solicit_messages (session,