* is popped! Do not use 'c' after the call. */
while (NULL != (out_msg = GCP_connection_pop (neighbor, c)))
{
- GNUNET_assert (NULL ==
- GCT_send_prebuilt_message (out_msg, t, NULL, GNUNET_YES,
- NULL, NULL));
+ GCT_resend_message (out_msg, t);
pending_msgs--;
}
GNUNET_STATISTICS_update (stats, "# messages dropped (buffer full)",
1, GNUNET_NO);
GNUNET_break (0);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "queue full: %u/%u\n",
- fc->queue_n, fc->queue_max);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "queue full: %u/%u\n",
+ fc->queue_n, fc->queue_max);
if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type)
{
fc->queue_n--;
return NULL; /* Drop this message */
}
- LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u\n", c, c->pending_messages);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %s %u\n",
+ GCC_2s (c), c->pending_messages);
c->pending_messages++;
q = GNUNET_new (struct CadetConnectionQueue);
size, c, fwd, &conn_message_sent, q);
if (NULL == q->q)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING dropping msg on %s\n", GCC_2s (c));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "dropping msg on %s, NULL q\n", GCC_2s (c));
GNUNET_free (data);
GNUNET_free (q);
return NULL;
return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL);
}
+/**
+ * Sends an already built and encrypted message on a tunnel, choosing the best
+ * connection. Useful for re-queueing messages queued on a destroyed connection.
+ *
+ * @param message Message to send. Function modifies it.
+ * @param t Tunnel on which this message is transmitted.
+ */
+void
+GCT_resend_message (const struct GNUNET_MessageHeader *message,
+ struct CadetTunnel *t)
+{
+ struct CadetConnection *c;
+ int fwd;
+
+ c = tunnel_get_connection (t);
+ if (NULL == c)
+ {
+ /* TODO queue in tunnel, marked as encrypted */
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "No connection available, dropping.\n");
+ return;
+ }
+ fwd = GCC_is_origin (c, GNUNET_YES);
+ GNUNET_break (NULL == GCC_send_prebuilt_message (message, 0, 0, c, fwd,
+ GNUNET_YES, NULL, NULL));
+}
+
/**
* Is the tunnel directed towards the local peer?
struct CadetTunnel *t, struct CadetConnection *c,
int force, GCT_sent cont, void *cont_cls);
+/**
+ * Sends an already built and encrypted message on a tunnel, choosing the best
+ * connection. Useful for re-queueing messages queued on a destroyed connection.
+ *
+ * @param message Message to send. Function modifies it.
+ * @param t Tunnel on which this message is transmitted.
+ */
+void
+GCT_resend_message (const struct GNUNET_MessageHeader *message,
+ struct CadetTunnel *t);
+
/**
* Is the tunnel directed towards the local peer?
*