GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
session->pending_messages_tail, pos);
GNUNET_assert (size >= pos->message_size);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "tcp",
+ "Transmitting message of type %u\n",
+ ntohs (((struct GNUNET_MessageHeader*)pos->msg)->type));
/* FIXME: this memcpy can be up to 7% of our total runtime */
memcpy (cbuf, pos->msg, pos->message_size);
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
}
session = cand_session;
}
- if ((session == NULL) && (addr == NULL))
+ if ((session == NULL) && (addrlen == 0))
{
#if DEBUG_TCP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
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
/* 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 %p for `%s', but should be for peer `%s'!\n",
+ session,
+ GNUNET_i2s (&session->target),
+ GNUNET_h2s (&target->hashPubKey));
+ return -1;
+ }
+
while ((ses != NULL) && (ses != session))
ses = ses->next;
if (ses == NULL)
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",
{
struct Session *session = cls;
struct GNUNET_TIME_Relative delay;
- struct GNUNET_TRANSPORT_ATS_Information ats;
+ struct GNUNET_ATS_Information ats;
session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK;
delay =
return;
}
session->last_activity = GNUNET_TIME_absolute_get ();
-#if DEBUG_TCP > 1
+#if DEBUG_TCP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
"Passing %u bytes of type %u from `%4s' to transport service.\n",
(unsigned int) ntohs (message->size),
GNUNET_STATISTICS_update (plugin->env->stats,
gettext_noop ("# bytes received via TCP"),
ntohs (message->size), GNUNET_NO);
- struct GNUNET_TRANSPORT_ATS_Information distance;
+ struct GNUNET_ATS_Information distance;
- distance.type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ distance.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
distance.value = htonl (1);
delay =
plugin->env->receive (plugin->env->cls, &session->target, message,
- (const struct GNUNET_TRANSPORT_ATS_Information *)
+ (const struct GNUNET_ATS_Information *)
&distance, 1, session,
(GNUNET_YES ==
session->inbound) ? NULL : session->connect_addr,