From b96794b04ab20a0aba439e48813238555739661d Mon Sep 17 00:00:00 2001 From: Jacek Masiulaniec Date: Wed, 3 Jun 2009 22:04:16 +0000 Subject: simplify struct batch; ok gilles@ --- usr.sbin/smtpd/mda.c | 12 +----------- usr.sbin/smtpd/mta.c | 15 +-------------- usr.sbin/smtpd/runner.c | 3 +-- usr.sbin/smtpd/smtpd.h | 42 ++++++++++++------------------------------ 4 files changed, 15 insertions(+), 57 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c index 73a93bf3fad..9c98b571f6c 100644 --- a/usr.sbin/smtpd/mda.c +++ b/usr.sbin/smtpd/mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda.c,v 1.19 2009/06/01 13:20:56 jacekm Exp $ */ +/* $OpenBSD: mda.c,v 1.20 2009/06/03 22:04:15 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -279,9 +279,7 @@ mda_dispatch_runner(int sig, short event, void *p) fatal("mda_dispatch_runner: calloc"); *batchp = *request; - batchp->session_id = s->s_id; batchp->env = env; - batchp->flags = 0; batchp->sessionp = s; s->batch = batchp; @@ -308,13 +306,6 @@ mda_dispatch_runner(int sig, short event, void *p) if (batchp == NULL) fatalx("mda_dispatch_runner: internal inconsistency."); - batchp->session_ss = messagep->session_ss; - strlcpy(batchp->session_hostname, - messagep->session_hostname, - sizeof(batchp->session_hostname)); - strlcpy(batchp->session_helo, messagep->session_helo, - sizeof(batchp->session_helo)); - TAILQ_INSERT_TAIL(&batchp->messages, messagep, entry); break; } @@ -331,7 +322,6 @@ mda_dispatch_runner(int sig, short event, void *p) if (batchp == NULL) fatalx("mda_dispatch_runner: internal inconsistency."); - batchp->flags |= F_BATCH_COMPLETE; s = batchp->sessionp; lookup = *batchp; diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index a203744f325..30fb02f8e60 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.56 2009/06/02 22:23:35 gilles Exp $ */ +/* $OpenBSD: mta.c,v 1.57 2009/06/03 22:04:15 jacekm Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -219,8 +219,6 @@ mta_dispatch_lka(int sig, short event, void *p) if (s == NULL) fatal("smtp_dispatch_parent: session is gone"); - s->batch->flags |= F_BATCH_RESOLVED; - do { ret = mta_connect(s); } while (ret == 0); @@ -383,9 +381,7 @@ mta_dispatch_runner(int sig, short event, void *p) fatal("mta_dispatch_runner: calloc"); *batchp = *request; - batchp->session_id = s->s_id; batchp->env = env; - batchp->flags = 0; batchp->sessionp = s; s->batch = batchp; @@ -415,13 +411,6 @@ mta_dispatch_runner(int sig, short event, void *p) if (batchp == NULL) fatalx("mta_dispatch_runner: internal inconsistency."); - batchp->session_ss = messagep->session_ss; - strlcpy(batchp->session_hostname, - messagep->session_hostname, - sizeof(batchp->session_hostname)); - strlcpy(batchp->session_helo, messagep->session_helo, - sizeof(batchp->session_helo)); - TAILQ_INSERT_TAIL(&batchp->messages, messagep, entry); break; } @@ -435,8 +424,6 @@ mta_dispatch_runner(int sig, short event, void *p) if (batchp == NULL) fatalx("mta_dispatch_runner: internal inconsistency."); - batchp->flags |= F_BATCH_COMPLETE; - /* assume temporary failure by default, safest choice */ batchp->status = S_BATCH_TEMPFAILURE; diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c index d995bb616fa..237ff9cc773 100644 --- a/usr.sbin/smtpd/runner.c +++ b/usr.sbin/smtpd/runner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: runner.c,v 1.49 2009/06/01 13:20:56 jacekm Exp $ */ +/* $OpenBSD: runner.c,v 1.50 2009/06/03 22:04:15 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -878,7 +878,6 @@ batch_record(struct smtpd *env, struct message *messagep) fatal("batch_record: calloc"); batchp->id = queue_generate_id(); - batchp->creation = messagep->creation; (void)strlcpy(batchp->message_id, messagep->message_id, sizeof(batchp->message_id)); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 4d6b7505fca..d46a07985f4 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.123 2009/06/03 18:16:29 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.124 2009/06/03 22:04:15 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -498,13 +498,6 @@ enum batch_type { T_DAEMON_BATCH = 0x4 }; -enum batch_flags { - F_BATCH_COMPLETE = 0x1, - F_BATCH_RESOLVED = 0x2, - F_BATCH_SCHEDULED = 0x4, - F_BATCH_EXPIRED = 0x8, -}; - enum child_type { CHILD_INVALID, CHILD_DAEMON, @@ -524,34 +517,23 @@ struct batch { SPLAY_ENTRY(batch) b_nodes; u_int64_t id; - u_int64_t session_id; enum batch_type type; - enum batch_flags flags; - - struct rule rule; - - struct smtpd *env; - - char message_id[MAX_ID_SIZE]; - char hostname[MAXHOSTNAMELEN]; - char errorline[MAX_LINE_SIZE]; + struct rule rule; - char session_helo[MAXHOSTNAMELEN]; - char session_hostname[MAXHOSTNAMELEN]; - struct sockaddr_storage session_ss; + struct smtpd *env; - time_t creation; - time_t lasttry; - u_int8_t retry; + char message_id[MAX_ID_SIZE]; + char hostname[MAXHOSTNAMELEN]; + char errorline[MAX_LINE_SIZE]; - struct session *sessionp; + struct session *sessionp; - struct message message; - struct message *messagep; - FILE *messagefp; - TAILQ_HEAD(messagelist, message) messages; + struct message message; + struct message *messagep; + FILE *messagefp; + TAILQ_HEAD(, message) messages; - enum batch_status status; + enum batch_status status; }; enum session_state { -- cgit v1.2.3