]> source.dussan.org Git - rspamd.git/commitdiff
* Make session before registering events
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 28 Jun 2010 12:27:27 +0000 (16:27 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 28 Jun 2010 12:27:27 +0000 (16:27 +0400)
src/smtp.c

index 0d3f4c63b5f7a22696bf1759912c903dff847de2..fd22f4080263bf7c82649917a410421b9f8473e0 100644 (file)
@@ -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