- struct StatsContext *stats_context = cls;
- char buf[512];
- size_t buf_len;
-
- if (NULL != emsg)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to get statistics: %s\n",
- emsg);
- GNUNET_SCHEDULER_shutdown ();
- GNUNET_free (stats_context);
- return;
- }
- if (NULL != data_file)
- {
- /* Stats lookup successful, write out data */
- buf_len =
- GNUNET_snprintf (buf, sizeof (buf),
- "TOTAL_NSE_RECEIVED_MESSAGES_%u: %u \n",
- current_round,
- stats_context->total_nse_received_messages);
- GNUNET_DISK_file_write (data_file, buf, buf_len);
- buf_len =
- GNUNET_snprintf (buf, sizeof (buf),
- "TOTAL_NSE_TRANSMITTED_MESSAGES_%u: %u\n",
- current_round,
- stats_context->total_nse_transmitted_messages);
- GNUNET_DISK_file_write (data_file, buf, buf_len);
- buf_len =
- GNUNET_snprintf (buf, sizeof (buf),
- "TOTAL_NSE_CROSS_%u: %u \n",
- current_round,
- stats_context->total_nse_cross);
- GNUNET_DISK_file_write (data_file, buf, buf_len);
- buf_len =
- GNUNET_snprintf (buf, sizeof (buf),
- "TOTAL_NSE_EXTRA_%u: %u \n",
- current_round,
- stats_context->total_nse_extra);
- GNUNET_DISK_file_write (data_file, buf, buf_len);
- buf_len =
- GNUNET_snprintf (buf, sizeof (buf),
- "TOTAL_NSE_DISCARDED_%u: %u \n",
- current_round,
- stats_context->total_discarded);
- GNUNET_DISK_file_write (data_file, buf, buf_len);
- }