Skip to content

Commit

Permalink
submission: Add support for module contexts to client.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanbosch authored and villesavolainen committed Feb 12, 2019
1 parent b8998f0 commit 3672ffa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/submission/submission-client.c
Expand Up @@ -44,6 +44,8 @@
static const struct smtp_server_callbacks smtp_callbacks;
static const struct submission_client_vfuncs submission_client_vfuncs;

struct submission_module_register submission_module_register = { 0 };

struct client *submission_clients;
unsigned int submission_client_count;

Expand Down Expand Up @@ -225,6 +227,8 @@ struct client *client_create(int fd_in, int fd_out,

client_parse_backend_capabilities(client);

p_array_init(&client->module_contexts, client->pool, 5);

client->conn = smtp_server_connection_create(smtp_server,
fd_in, fd_out, user->conn.remote_ip, user->conn.remote_port,
FALSE, &smtp_set, &smtp_callbacks, client);
Expand Down
13 changes: 13 additions & 0 deletions src/submission/submission-client.h
Expand Up @@ -79,13 +79,26 @@ struct client {
struct submission_backend *backends;
unsigned int backends_count;

/* Module-specific contexts. */
ARRAY(union submission_module_context *) module_contexts;

bool standalone:1;
bool disconnected:1;
bool destroyed:1;
bool anvil_sent:1;
bool backend_capabilities_configured:1;
};

struct submission_module_register {
unsigned int id;
};

union submission_module_context {
struct submission_client_vfuncs super;
struct submission_module_register *reg;
};
extern struct submission_module_register submission_module_register;

extern struct client *submission_clients;
extern unsigned int submission_client_count;

Expand Down

0 comments on commit 3672ffa

Please sign in to comment.