From: Vsevolod Stakhov Date: Mon, 28 Jun 2010 12:27:27 +0000 (+0400) Subject: * Make session before registering events X-Git-Tag: 0.3.1~76 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d4944acc204d3cd9d03fe41f39afbd740ebc00c2;p=rspamd.git * Make session before registering events --- diff --git a/src/smtp.c b/src/smtp.c index 0d3f4c63b..fd22f4080 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -794,16 +794,14 @@ accept_socket (int fd, short what, void *arg) return; } else { + /* Set up async session */ + session->s = new_async_session (session->pool, free_smtp_session, session); register_async_event (session->s, (event_finalizer_t)smtp_dns_cb, NULL, TRUE); + /* Set up dispatcher */ + session->dispatcher = rspamd_create_dispatcher (nfd, BUFFER_LINE, + smtp_read_socket, smtp_write_socket, smtp_err_socket, &session->ctx->smtp_timeout, session); + session->dispatcher->peer_addr = session->client_addr.s_addr; } - - /* Set up dispatcher */ - session->dispatcher = rspamd_create_dispatcher (nfd, BUFFER_LINE, - smtp_read_socket, smtp_write_socket, smtp_err_socket, &session->ctx->smtp_timeout, session); - session->dispatcher->peer_addr = session->client_addr.s_addr; - /* Set up async session */ - session->s = new_async_session (session->pool, free_smtp_session, session); - } static void