diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2012-03-25 08:44:25 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2012-03-25 08:44:25 +0000 |
commit | 85abb75f87fda11a365a28d24be2799a5b1cdfb7 (patch) | |
tree | 6a6c55d8c81ddc99e16e05406b1713f218353fcb /usr.sbin/smtpd/mta.c | |
parent | e3d65c47f3e7f0b4b2f79c913cccc88e7b75661e (diff) |
Do not fatal() when failing to connect to a relay.
Instead, drop the relay and try the next one.
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/mta.c')
-rw-r--r-- | usr.sbin/smtpd/mta.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index 87adae795ed..6eacc235889 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.127 2012/02/01 20:30:40 eric Exp $ */ +/* $OpenBSD: mta.c,v 1.128 2012/03/25 08:44:24 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -491,8 +491,19 @@ mta_enter_state(struct mta_session *s, int newstate) iobuf_init(&s->iobuf, 0, 0); io_init(&s->io, -1, s, mta_io, &s->iobuf); io_set_timeout(&s->io, 10000); - if (io_connect(&s->io, sa) == -1) - fatal("mta cannot create socket"); + if (io_connect(&s->io, sa) == -1) { + log_debug("mta: %p: connection failed: %s", s, + strerror(errno)); + iobuf_clear(&s->iobuf); + /* + * This error is most likely a "no route", + * so there is no need to try the same + * relay again. + */ + TAILQ_REMOVE(&s->relays, relay, entry); + free(relay); + continue; + } return; } /* tried them all? */ |