--- /dev/null
+ o Major bugfixes (directory servers):
+ - Don't count networkstatus serves until they finish. When we started
+ serving a consensus document but the client didn't receive all of
+ it, we were still counting that as a success in our stats. This
+ mistake, which can be triggered for example by obsolete clients
+ or by DPI-based censorship, led to wildly inflated user counts
+ because we estimate total users in the world based on successful
+ consensus fetches. Fixes bug 41192; bugfix on 0.2.1.1-alpha.
+
goto done;
}
+ /* Success: we are going to try serving it. */
+ conn->should_count_geoip_when_finished = 1;
+
tor_addr_t addr;
if (tor_addr_parse(&addr, (TO_CONN(conn))->address) >= 0) {
- geoip_note_client_seen(GEOIP_CLIENT_NETWORKSTATUS,
- &addr, NULL,
- time(NULL));
- geoip_note_ns_response(GEOIP_SUCCESS);
/* Note that a request for a network status has started, so that we
* can measure the download time later on. */
if (conn->dirreq_id)
#include "feature/nodelist/routerlist.h"
#include "feature/relay/router.h"
#include "feature/relay/routermode.h"
+#include "feature/stats/geoip_stats.h"
#include "feature/stats/predict_ports.h"
#include "feature/dircache/cached_dir_st.h"
tor_compress_free(conn->compress_state);
conn->compress_state = NULL;
}
+ if (conn->should_count_geoip_when_finished) {
+ /* only count successfully networkstatus serves when the spool runs dry */
+ tor_addr_t addr;
+ if (tor_addr_parse(&addr, (TO_CONN(conn))->address) >= 0) {
+ geoip_note_client_seen(GEOIP_CLIENT_NETWORKSTATUS,
+ &addr, NULL,
+ time(NULL));
+ }
+ geoip_note_ns_response(GEOIP_SUCCESS);
+ conn->should_count_geoip_when_finished = 0;
+ }
return 0;
}
* needs this for the incoming side, so it's moved here. */
uint64_t dirreq_id;
+ /** 0 normally, 1 if we're serving a consensus and we're delaying counting
+ * geoip until we've served the final bytes. */
+ bool should_count_geoip_when_finished;
+
#ifdef MEASUREMENTS_21206
/** Number of RELAY_DATA cells received. */
uint32_t data_cells_received;