return;
}
if (bytes_to_send > stream->backlog_size) {
- log(WARNING, "[%s] Client lost %lld bytes, maybe too slow connection",
- client->remote_addr.c_str(),
- (long long int)(bytes_to_send - stream->backlog_size));
+ size_t bytes_lost = bytes_to_send - stream->backlog_size;
client->stream_pos = stream->bytes_received - stream->backlog_size;
- client->bytes_lost += bytes_to_send - stream->backlog_size;
+ client->bytes_lost += bytes_lost;
++client->num_loss_events;
bytes_to_send = stream->backlog_size;
+
+ double loss_fraction = double(client->bytes_lost) / double(client->bytes_lost + client->bytes_sent);
+ log(WARNING, "[%s] Client lost %lld bytes (total loss: %.2f%%), maybe too slow connection",
+ client->remote_addr.c_str(),
+ (long long int)(bytes_lost),
+ 100.0 * loss_fraction);
}
// See if we need to split across the circular buffer.