/* Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.  */
int gnet_stats_copy_rate_est(struct gnet_dump *d, const struct gnet_stats_basic_packed *b, struct gnet_stats_rate_est *r)
/* Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.  */
int gnet_stats_copy_rate_est(struct gnet_dump *d, const struct gnet_stats_basic_packed *b, struct gnet_stats_rate_est *r)
{
	if (b && !gen_estimator_active(b, r))
		return 0;
	if (d->compat_tc_stats) {
		d->tc_stats.bps = r->bps;
		d->tc_stats.pps = r->pps;
	}
	if (d->tail)
		return gnet_stats_copy(d, TCA_STATS_RATE_EST, r, sizeof(*r));
	return 0;
}