/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
#include "lmtp-common.h"
+#include "smtp-server.h"
#include "str.h"
#include "istream.h"
#include "strescape.h"
struct mail *raw_mail, *first_saved_mail;
struct mail_user *rcpt_user;
+
+ struct smtp_server_stats stats;
};
/*
local = i_new(struct lmtp_local, 1);
local->client = client;
i_array_init(&local->rcpt_to, 8);
-
+ const struct smtp_server_stats *stats =
+ smtp_server_connection_get_stats(local->client->conn);
+ local->stats = *stats;
return local;
}
dinput.delivery_time_started = lldctx->delivery_time_started;
mail_deliver_init(&dctx, &dinput);
+
+ /* Copy statistics to mail user session event here */
+ const struct smtp_server_stats *stats =
+ smtp_server_connection_get_stats(local->client->conn);
+ event_add_int(event, "net_in_bytes",
+ stats->input - local->stats.input);
+ event_add_int(event, "net_out_bytes",
+ stats->output - local->stats.output);
+ event_add_int(lrcpt->rcpt->event, "net_in_bytes",
+ stats->input - local->stats.input);
+ event_add_int(lrcpt->rcpt->event, "net_out_bytes",
+ stats->output - local->stats.output);
+ local->stats = *stats;
ret = lmtp_local_default_do_deliver(local, llrcpt, lldctx, &dctx);
mail_deliver_deinit(&dctx);
+
event_unref(&event);
return ret;