diff -r c81f1ca3cda6 src/plugins/stats/stats-plugin.c
--- a/src/plugins/stats/stats-plugin.c	Wed Nov 28 04:29:58 2012 +0200
+++ b/src/plugins/stats/stats-plugin.c	Wed Nov 28 04:30:03 2012 +0200
@@ -55,8 +55,6 @@
 static int proc_io_fd = -1;
 
 static struct stats_connection *global_stats_conn = NULL;
-static struct mail_user *stats_global_user = NULL;
-static unsigned int stats_user_count = 0;
 
 static void session_stats_refresh_timeout(struct mail_user *user);
 
@@ -188,16 +186,7 @@
 	struct mail_user *user = context;
 	struct stats_user *suser = STATS_USER_CONTEXT(user);
 
-	if (stats_user_count == 1) {
-		/* the first user sets the global user. the second user sets
-		   it to NULL. when we get back to one user we'll need to set
-		   the global user again somewhere. do it here. */
-		stats_global_user = user;
-	} else {
-		i_assert(stats_global_user == NULL);
-
-		mail_stats_get(suser, &suser->pre_io_stats);
-	}
+	mail_stats_get(suser, &suser->pre_io_stats);
 }
 
 static void timeval_add_diff(struct timeval *dest,
@@ -489,8 +478,6 @@
 
 static void session_stats_refresh_timeout(struct mail_user *user)
 {
-	if (stats_global_user != NULL)
-		stats_add_session(user);
 	session_stats_refresh(user);
 }
 
@@ -500,13 +487,10 @@
 	struct stats_user *suser = STATS_USER_CONTEXT(user);
 	unsigned int last_update_secs;
 
-	if (stats_global_user == NULL)
-		stats_add_session(user);
+	stats_add_session(user);
 
 	last_update_secs = time(NULL) - suser->last_session_update;
 	if (last_update_secs >= suser->refresh_secs) {
-		if (stats_global_user != NULL)
-			stats_add_session(user);
 		session_stats_refresh(user);
 	} else if (suser->to_stats_timeout == NULL) {
 		suser->to_stats_timeout =
@@ -520,16 +504,6 @@
 	struct stats_user *suser = STATS_USER_CONTEXT(user);
 	struct stats_connection *stats_conn = suser->stats_conn;
 
-	i_assert(stats_user_count > 0);
-	if (--stats_user_count == 0) {
-		/* we were updating the session lazily. do one final update. */
-		i_assert(stats_global_user == user);
-		stats_add_session(user);
-		stats_global_user = NULL;
-	} else {
-		i_assert(stats_global_user == NULL);
-	}
-
 	io_loop_context_remove_callbacks(suser->ioloop_ctx,
 					 stats_io_activate,
 					 stats_io_deactivate, user);
@@ -582,21 +556,6 @@
 	}
 	stats_connection_ref(global_stats_conn);
 
-	if (stats_user_count == 0) {
-		/* first user connection */
-		stats_global_user = user;
-	} else if (stats_user_count == 1) {
-		/* second user connection. we'll need to start doing
-		   per-io callback tracking now. (we might have been doing it
-		   also previously but just temporarily quickly dropped to
-		   having 1 user, in which case stats_global_user=NULL) */
-		if (stats_global_user != NULL) {
-			stats_add_session(stats_global_user);
-			stats_global_user = NULL;
-		}
-	}
-	stats_user_count++;
-
 	suser = p_new(user->pool, struct stats_user, 1);
 	suser->module_ctx.super = *v;
 	user->vlast = &suser->module_ctx.super;
