diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-09-22 20:22:31 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-09-22 20:22:31 +0400 |
commit | 626a11ad9819593eadaca1e321192c75a32b51f3 (patch) | |
tree | 7f062ddf5d6ec04d7e2f4009541aa417df1cfe59 /src/lmtp_proto.c | |
parent | fe815ce580d3c455292e1acda406ddb4d371120a (diff) | |
download | rspamd-626a11ad9819593eadaca1e321192c75a32b51f3.tar.gz rspamd-626a11ad9819593eadaca1e321192c75a32b51f3.zip |
* Implement new system of async events handling (experimental)
Diffstat (limited to 'src/lmtp_proto.c')
-rw-r--r-- | src/lmtp_proto.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/lmtp_proto.c b/src/lmtp_proto.c index 62967c03b..7fbc38684 100644 --- a/src/lmtp_proto.c +++ b/src/lmtp_proto.c @@ -293,13 +293,13 @@ close_mta_connection (struct mta_callback_data *cd, gboolean is_success) else { out_lmtp_reply (cd->task, LMTP_FAILURE, "", "Delivery failure"); } - cd->dispatcher->wanna_die = TRUE; + rspamd_remove_dispatcher (cd->dispatcher); } /* * Callback that is called when there is data to read in buffer */ -static void +static gboolean mta_read_socket (f_str_t *in, void *arg) { struct mta_callback_data *cd = (struct mta_callback_data *)arg; @@ -317,7 +317,7 @@ mta_read_socket (f_str_t *in, void *arg) if (fstrstr (in, &contres1) != -1 || fstrstr (in, &contres2) != -1) { /* Skip such lines */ - return; + return TRUE; } switch (cd->state) { @@ -325,7 +325,7 @@ mta_read_socket (f_str_t *in, void *arg) if (!parse_mta_str (in, cd)) { msg_warn ("mta_read_socket: got bad greeting"); close_mta_connection (cd, FALSE); - return; + return FALSE; } hostmax = sysconf (_SC_HOST_NAME_MAX) + 1; hostbuf = alloca (hostmax); @@ -344,7 +344,7 @@ mta_read_socket (f_str_t *in, void *arg) if (!parse_mta_str (in, cd)) { msg_warn ("mta_read_socket: got bad helo"); close_mta_connection (cd, FALSE); - return; + return FALSE; } r = snprintf (outbuf, sizeof (outbuf), "MAIL FROM: <%s>" CRLF, cd->task->from); rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE, FALSE); @@ -354,7 +354,7 @@ mta_read_socket (f_str_t *in, void *arg) if (!parse_mta_str (in, cd)) { msg_warn ("mta_read_socket: got bad mail from"); close_mta_connection (cd, FALSE); - return; + return FALSE; } cur = g_list_first (cd->task->rcpt); r = 0; @@ -370,7 +370,7 @@ mta_read_socket (f_str_t *in, void *arg) if (!parse_mta_str (in, cd)) { msg_warn ("mta_read_socket: got bad rcpt"); close_mta_connection (cd, FALSE); - return; + return FALSE; } r = snprintf (outbuf, sizeof (outbuf), "DATA" CRLF); rspamd_dispatcher_write (cd->task->dispatcher, outbuf, r, FALSE, FALSE); @@ -380,7 +380,7 @@ mta_read_socket (f_str_t *in, void *arg) if (!parse_mta_str (in, cd)) { msg_warn ("mta_read_socket: got bad data"); close_mta_connection (cd, FALSE); - return; + return FALSE; } c = g_mime_object_to_string ((GMimeObject *)cd->task->message); r = strlen (c); @@ -393,11 +393,13 @@ mta_read_socket (f_str_t *in, void *arg) if (!parse_mta_str (in, cd)) { msg_warn ("mta_read_socket: message not delivered"); close_mta_connection (cd, FALSE); - return; + return FALSE; } close_mta_connection (cd, TRUE); break; } + + return TRUE; } /* |