+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Calling continuation for %u byte message to `%s' with result %s\n",
+ udpw->payload_size, GNUNET_i2s (&udpw->session->target),
+ (GNUNET_OK == result) ? "OK" : "SYSERR");
+
+ if (udpw->msg_size >= udpw->payload_size)
+ overhead = udpw->msg_size - udpw->payload_size;
+ else
+ overhead = udpw->msg_size;
+
+ switch (result) {
+ case GNUNET_OK:
+ switch (udpw->msg_type) {
+ case MSG_UNFRAGMENTED:
+ if (NULL != udpw->cont)
+ {
+ /* Transport continuation */
+ udpw->cont (udpw->cont_cls, &udpw->session->target, result,
+ udpw->payload_size, overhead);
+ }
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, unfragmented msgs, messages, sent, success",
+ 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, unfragmented msgs, bytes payload, sent, success",
+ udpw->payload_size, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, unfragmented msgs, bytes overhead, sent, success",
+ overhead, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, total, bytes overhead, sent",
+ overhead, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, total, bytes payload, sent",
+ udpw->payload_size, GNUNET_NO);
+ break;
+ case MSG_FRAGMENTED_COMPLETE:
+ GNUNET_assert (NULL != udpw->frag_ctx);
+ if (udpw->frag_ctx->cont != NULL)
+ udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, &udpw->session->target, GNUNET_OK,
+ udpw->frag_ctx->payload_size, udpw->frag_ctx->on_wire_size);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, messages, sent, success",
+ 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, bytes payload, sent, success",
+ udpw->payload_size, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, bytes overhead, sent, success",
+ overhead, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, total, bytes overhead, sent",
+ overhead, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, total, bytes payload, sent",
+ udpw->payload_size, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, messages, pending",
+ -1, GNUNET_NO);
+ break;
+ case MSG_FRAGMENTED:
+ /* Fragmented message: enqueue next fragment */
+ if (NULL != udpw->cont)
+ udpw->cont (udpw->cont_cls, &udpw->session->target, result,
+ udpw->payload_size, udpw->msg_size);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, fragments, sent, success",
+ 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, fragments bytes, sent, success",
+ udpw->msg_size, GNUNET_NO);
+ break;
+ case MSG_ACK:
+ /* No continuation */
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, ACK msgs, messages, sent, success",
+ 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, ACK msgs, bytes overhead, sent, success",
+ overhead, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, total, bytes overhead, sent",
+ overhead, GNUNET_NO);
+ break;
+ case MSG_BEACON:
+ GNUNET_break (0);
+ break;
+ default:
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "ERROR: %u\n", udpw->msg_type);
+ GNUNET_break (0);
+ break;
+ }
+ break;
+ case GNUNET_SYSERR:
+ switch (udpw->msg_type) {
+ case MSG_UNFRAGMENTED:
+ /* Unfragmented message: failed to send */
+ if (NULL != udpw->cont)
+ udpw->cont (udpw->cont_cls, &udpw->session->target, result,
+ udpw->payload_size, overhead);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, unfragmented msgs, messages, sent, failure",
+ 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, unfragmented msgs, bytes payload, sent, failure",
+ udpw->payload_size, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, unfragmented msgs, bytes overhead, sent, failure",
+ overhead, GNUNET_NO);
+ break;
+ case MSG_FRAGMENTED_COMPLETE:
+ GNUNET_assert (NULL != udpw->frag_ctx);
+ if (udpw->frag_ctx->cont != NULL)
+ udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, &udpw->session->target, GNUNET_SYSERR,
+ udpw->frag_ctx->payload_size, udpw->frag_ctx->on_wire_size);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, messages, sent, failure",
+ 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, bytes payload, sent, failure",
+ udpw->payload_size, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, bytes payload, sent, failure",
+ overhead, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, bytes payload, sent, failure",
+ overhead, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, messages, pending",
+ -1, GNUNET_NO);
+ break;
+ case MSG_FRAGMENTED:
+ GNUNET_assert (NULL != udpw->frag_ctx);
+ /* Fragmented message: failed to send */
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, fragments, sent, failure",
+ 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragmented msgs, fragments bytes, sent, failure",
+ udpw->msg_size, GNUNET_NO);
+ break;
+ case MSG_ACK:
+ /* ACK message: failed to send */
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, ACK msgs, messages, sent, failure",
+ 1, GNUNET_NO);
+ break;
+ case MSG_BEACON:
+ /* Beacon message: failed to send */
+ GNUNET_break (0);
+ break;
+ default:
+ GNUNET_break (0);
+ break;
+ }
+ break;
+ default:
+ GNUNET_break (0);
+ break;
+ }