[mirrorbrain-commits] [mod_asn] r74 - /trunk/mod_asn.c

From: <poeml_at_mirrorbrain.org>
Date: Fri, 26 Mar 2010 21:27:12 -0000
Author: poeml
Date: Fri Mar 26 22:27:11 2010
New Revision: 74

URL: http://svn.mirrorbrain.org/viewvc/mod_asn?rev=74&view=rev
Log:
mod_asn:
- Database errors from the lower DBD layer are now resolved to strings, where available
- If an IP address is not found it isn't necessarily an error, because it could
  be a private IP for instance. That case is now logged with NOTICE log level.

Modified:
    trunk/mod_asn.c

Modified: trunk/mod_asn.c
URL: http://svn.mirrorbrain.org/viewvc/mod_asn/trunk/mod_asn.c?rev=74&r1=73&r2=74&view=diff
==============================================================================
--- trunk/mod_asn.c (original)
+++ trunk/mod_asn.c Fri Mar 26 22:27:11 2010
_at_@ -315,10 +315,17 @@
 
     /* we care only about the 1st row, because our query uses 'limit 1' */
     rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, DBD_FIRST_ROW);
-    if (rv != 0) {
-        ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                      "[mod_asn] Error retrieving row from database for %s", 
-                      clientip);
+    if (rv != APR_SUCCESS) {
+        if (rv == -1) {
+            /* not an error - might be a private IP, for instance */
+            ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
+                          "[mod_asn] IP %s not found", clientip);
+        } else {
+            const char *errmsg = apr_dbd_error(dbd->driver, dbd->handle, rv);
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+                          "[mod_asn] Error retrieving row from database for %s: %s", 
+                          clientip, (errmsg ? errmsg : "[???]"));
+        }
         return DECLINED;
     }
 




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Fri Mar 26 2010 - 21:27:14 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT