simplify
authorChristian Grothoff <christian@grothoff.org>
Mon, 17 Oct 2011 12:10:02 +0000 (12:10 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 17 Oct 2011 12:10:02 +0000 (12:10 +0000)
src/transport/gnunet-service-transport.c
src/transport/gnunet-service-transport_neighbours.c
src/transport/plugin_transport_tcp.c

index 0a56c85a18eeb3d378089d1c77c4e40a6e20a60d..5bde153e4e28242de10f5e73c097cfecf31f5b28 100644 (file)
@@ -243,6 +243,13 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
 
         GNUNET_free (im);
       }
+      else     
+       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                   _("Discarded %u bytes of type %u from %s via plugin %s: connection is down!\n"),
+                   ntohs (message->size),
+                   type,
+                   GNUNET_i2s (peer),
+                   plugin_name);
       break;
     }
   }
index 3dc70792374b501b250ac495f83446a9aa665867..9676366a61f4d0865246959e9626190416cccf77 100644 (file)
@@ -798,9 +798,6 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
 
   if (GNUNET_YES != n->is_connected)
     return;                     /* not connected anymore anyway, shouldn't matter */
-
-  //n->is_connected = GNUNET_NO;
-
   /* fast disconnect unless ATS suggests a new address */
   GNUNET_SCHEDULER_cancel (n->timeout_task);
   n->timeout_task =
@@ -869,8 +866,6 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg,
       cont (cont_cls, GNUNET_SYSERR);
     return;
   }
-
-
   GNUNET_assert (msg_size >= sizeof (struct GNUNET_MessageHeader));
   GNUNET_STATISTICS_update (GST_stats,
                             gettext_noop
@@ -917,6 +912,14 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity
     *do_forward = GNUNET_NO;
     return GNUNET_TIME_UNIT_ZERO;
   }
+  if (GNUNET_YES != n->is_connected)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+               _("Plugin gave us %d bytes of data but somehow the session is not marked as UP yet!\n"),
+               (int) size);
+    *do_forward = GNUNET_NO;
+    return GNUNET_TIME_UNIT_ZERO;
+  }
   if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, size))
   {
     n->quota_violation_count++;
index 8856b926264bde6d6fa26dc687afc4840fb264c5..d3391e1b2d268a3ff723c37c7e5e891e7d7b5e4b 100644 (file)
@@ -701,7 +701,7 @@ do_transmit (void *cls, size_t size, void *buf)
     cbuf += pos->message_size;
     ret += pos->message_size;
     size -= pos->message_size;
-    GNUNET_CONTAINER_DLL_insert_after (hd, tl, tl, pos);
+    GNUNET_CONTAINER_DLL_insert_tail (hd, tl, pos);
   }
   /* schedule 'continuation' before callbacks so that callbacks that
    * cancel everything don't cause us to use a session that no longer
@@ -1066,8 +1066,7 @@ tcp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
       pm->transmit_cont_cls = cont_cls;
 
       /* append pm to pending_messages list */
-      GNUNET_CONTAINER_DLL_insert_after (session->pending_messages_head,
-                                         session->pending_messages_tail,
+      GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head,
                                          session->pending_messages_tail, pm);
 
       GNUNET_assert (GNUNET_CONTAINER_multihashmap_put
@@ -1151,9 +1150,8 @@ tcp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
   pm->transmit_cont_cls = cont_cls;
 
   /* append pm to pending_messages list */
-  GNUNET_CONTAINER_DLL_insert_after (session->pending_messages_head,
-                                     session->pending_messages_tail,
-                                     session->pending_messages_tail, pm);
+  GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head,
+                                   session->pending_messages_tail, pm);
 #if DEBUG_TCP
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
                    "Asked to transmit %u bytes to `%s', added message to list.\n",