changeset 320:e27c24c1974a

more smtp verify logging
author Carl Byington <carl@five-ten-sg.com>
date Sat, 17 Dec 2016 09:46:40 -0800
parents 0ed4de7ce05b
children e172dc10fe24
files src/context.cpp src/context.h
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/context.cpp	Thu Sep 22 08:49:44 2016 -0700
+++ b/src/context.cpp	Sat Dec 17 09:46:40 2016 -0800
@@ -268,6 +268,13 @@
 }
 
 
+void VERIFY::log(const char *m, const char *q, const char *v) {
+    char buf[maxlen];
+    snprintf(buf, maxlen, m, v, host);
+    my_syslog(q, buf);
+}
+
+
 void VERIFY::closer() {
     bool ok = true;
     while (ok) {
@@ -391,7 +398,10 @@
 bool VERIFY::ok(const char *queueid, const char *from, const char *to) {
     if (host == token_myhostname) return true;
     SMTP *conn = get_connection(queueid);
-    if (!conn) return true;    // cannot verify right now, we have socket errors
+    if (!conn) {
+        log("unable to verify %s with %s due to socket errors", queueid, to);
+        return true;    // cannot verify right now, we have socket errors
+    }
     int rc;
     rc = conn->from(from);
     conn->log("verify::ok(%d) from sees %d", rc);
--- a/src/context.h	Thu Sep 22 08:49:44 2016 -0700
+++ b/src/context.h	Sat Dec 17 09:46:40 2016 -0800
@@ -91,6 +91,7 @@
     smtp_list       connections;// open sockets, ready to be used
 public:
     VERIFY(const char *h);
+    void    log(const char *m, const char *q, const char *v);
     void    closer();           // if the oldest socket is ancient, close it
     SMTP    *get_connection(const char *queueid);
     void    put_connection(SMTP *conn);