static struct CadetTConnection *
get_ready_connection (struct CadetTunnel *t)
{
- return t->connection_ready_head;
+ struct CadetTConnection *hd = t->connection_ready_head;
+
+ GNUNET_assert ( (NULL == hd) ||
+ (GNUNET_YES == hd->is_ready) );
+ return hd;
}
struct GNUNET_CADET_TunnelKeyExchangeMessage *msg;
enum GNUNET_CADET_KX_Flags flags;
- if (NULL == ct)
+ if ( (NULL == ct) ||
+ (GNUNET_NO == ct->is_ready) )
ct = get_ready_connection (t);
if (NULL == ct)
{
1,
GNUNET_NO);
send_kx (t,
- NULL,
+ ct,
&t->ax);
return;
}
struct CadetTunnel *t = ct->t;
if (GNUNET_YES == ct->is_ready)
+ {
GNUNET_CONTAINER_DLL_remove (t->connection_ready_head,
t->connection_ready_tail,
ct);
+ t->num_ready_connections--;
+ }
else
+ {
GNUNET_CONTAINER_DLL_remove (t->connection_busy_head,
t->connection_busy_tail,
ct);
+ t->num_busy_connections--;
+ }
GNUNET_free (ct);
}
break;
}
- GNUNET_STATISTICS_update (stats,
- "# received encrypted",
- 1,
- GNUNET_NO);
decrypted_size = -1;
if (CADET_TUNNEL_KEY_OK == t->estate)
{
&t->ax);
return;
}
+ GNUNET_STATISTICS_update (stats,
+ "# decrypted bytes",
+ decrypted_size,
+ GNUNET_NO);
/* The MST will ultimately call #handle_decrypted() on each message. */
t->current_ct = ct;
&ax_msg[1],
message,
payload_size);
+ GNUNET_STATISTICS_update (stats,
+ "# encrypted bytes",
+ payload_size,
+ GNUNET_NO);
ax_msg->ax_header.Ns = htonl (t->ax.Ns++);
ax_msg->ax_header.PNs = htonl (t->ax.PNs);
/* FIXME: we should do this once, not once per message;