Skip to content

Commit

Permalink
submission: RCPT command: Move starting the backend transaction from …
Browse files Browse the repository at this point in the history
…submission-commands.c to submission-backend.c.

This way, the transaction is only started from RCPT when the backend needs it at this point.
  • Loading branch information
stephanbosch committed Oct 14, 2018
1 parent 69e8b91 commit 3fe59d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/submission/submission-backend.c
Expand Up @@ -5,6 +5,7 @@
#include "istream.h"
#include "istream-sized.h"

#include "submission-recipient.h"
#include "submission-client.h"
#include "submission-commands.h"
#include "submission-backend.h"
Expand Down Expand Up @@ -179,11 +180,17 @@ int submission_backend_cmd_rcpt(struct submission_backend *backend,
struct smtp_server_cmd_ctx *cmd,
struct submission_recipient *srcpt)
{
struct smtp_server_transaction *trans;

if (backend->v.cmd_rcpt == NULL) {
/* backend is not interested, respond right away */
return 1;
}

trans = smtp_server_connection_get_transaction(cmd->conn);
if (trans != NULL)
submission_backend_trans_start(srcpt->backend, trans);

return backend->v.cmd_rcpt(backend, cmd, srcpt);
}

Expand Down
6 changes: 0 additions & 6 deletions src/submission/submission-commands.c
Expand Up @@ -159,12 +159,6 @@ int client_default_cmd_rcpt(struct client *client ATTR_UNUSED,
struct smtp_server_cmd_ctx *cmd,
struct submission_recipient *srcpt)
{
struct smtp_server_transaction *trans;

trans = smtp_server_connection_get_transaction(cmd->conn);
if (trans != NULL)
submission_backend_trans_start(srcpt->backend, trans);

return submission_backend_cmd_rcpt(srcpt->backend, cmd, srcpt);
}

Expand Down

0 comments on commit 3fe59d1

Please sign in to comment.