getaddrinfo() does not distinguish between "DNS server not reachable" and "DNS server told me host does not exist". For SMARTHOSTS it is better to defer than to bounce in order to survive network outages. Bug: fixes #30
So far dma would sleep for the whole backoff period before retrying a delivery. However, this also meant that a user issuing `dma -q` could not force these mails to be retried immediately. Switch to sleeping for only 30 seconds at a time, and poll the mtime of a special queue flush signal file `flush` in the spool directory. If the flush file has been touched since the beginning of the backoff period, initiate a retry right away. When flushing the queue with `dma -q` we now touch the flush file to make waiting instances of dma process this user request. The 30 second poll interval at the same time avoids a DoS via excessive `dma -q` by any user. fixes #3 Bug: #3
When we can't lock a queue file during flush it means another process is already sitting on the item, so no need to complain or return error.
sendmail's -q takes an optional argument, but the way we use getopt(3) does not support this. Work around this by backtracking if the argument to -q starts with a dash, indicating that it is an option instead.