summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-17 12:10:02 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-17 12:10:02 +0000
commit7607c33464325ae6974ca2a685940b1438120fe2 (patch)
tree9dbe388b27d38d709d2535158324ca15d9247719
parentbbd9867e477ed9a528b0d9a17c9671032395da67 (diff)
simplify
-rw-r--r--src/transport/gnunet-service-transport.c7
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c13
-rw-r--r--src/transport/plugin_transport_tcp.c10
3 files changed, 19 insertions, 11 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 0a56c85a1..5bde153e4 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -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;
}
}
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 3dc707923..9676366a6 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -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++;
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 8856b9262..d3391e1b2 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -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",