diff options
author | rsc <devnull@localhost> | 2006-02-11 23:38:55 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-02-11 23:38:55 +0000 |
commit | b5f65921f346e6b4335f77e457ac5bcae0ab9d67 (patch) | |
tree | d85d6da9def0b62b51537bf6348b43252ad69f5f /src/cmd/upas/smtp/mxdial.c | |
parent | e4d832222ba5519db94c7512c1fb82bd32491120 (diff) | |
download | plan9port-b5f65921f346e6b4335f77e457ac5bcae0ab9d67.tar.gz plan9port-b5f65921f346e6b4335f77e457ac5bcae0ab9d67.tar.bz2 plan9port-b5f65921f346e6b4335f77e457ac5bcae0ab9d67.zip |
various cleanup
Diffstat (limited to 'src/cmd/upas/smtp/mxdial.c')
-rw-r--r-- | src/cmd/upas/smtp/mxdial.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/cmd/upas/smtp/mxdial.c b/src/cmd/upas/smtp/mxdial.c index aea5f256..13f40ab5 100644 --- a/src/cmd/upas/smtp/mxdial.c +++ b/src/cmd/upas/smtp/mxdial.c @@ -1,6 +1,7 @@ #include "common.h" #include <ndb.h> #include "smtp.h" /* to publish dial_string_parse */ +#include <ip.h> enum { @@ -42,14 +43,20 @@ mxdial(char *addr, char *ddomain, char *gdomain) /* try our mail gateway */ rerrstr(err, sizeof(err)); - if(fd < 0 && gdomain && strstr(err, "can't translate") != 0) { - fprint(2,"dialing %s\n",gdomain); + if(fd < 0 && gdomain && strstr(err, "can't translate") != 0) fd = dial(netmkaddr(gdomain, 0, "smtp"), 0, 0, 0); - } return fd; } +static int +timeout(void*, char *msg) +{ + if(strstr(msg, "alarm")) + return 1; + return 0; +} + /* * take an address and return all the mx entries for it, * most preferred first @@ -92,7 +99,11 @@ callmx(DS *ds, char *dest, char *domain) mx[i].host, ds->service); if(debug) fprint(2, "mxdial trying %s\n", addr); + atnotify(timeout, 1); + alarm(10*1000); fd = dial(addr, 0, 0, 0); + alarm(0); + atnotify(timeout, 0); if(fd >= 0) return fd; } @@ -316,6 +327,7 @@ expand_meta(DS *ds) } #endif /* jpc */ +/* XXX */ static void expand_meta(DS *ds) { |