Logging Adjustments
authorJayson Vantuyl <jvantuyl@engineyard.com>
Tue, 24 Feb 2009 15:34:31 -0800
changeset 588 d4468955feb1
parent 587 7c793095138e
child 589 5ed52ee1e2d9
Logging Adjustments
loudmouth/lm-old-socket.c
loudmouth/lm-resolver.c
--- a/loudmouth/lm-old-socket.c	Mon Feb 23 23:09:45 2009 -0800
+++ b/loudmouth/lm-old-socket.c	Tue Feb 24 15:34:31 2009 -0800
@@ -35,6 +35,7 @@
 #include <arpa/nameser_compat.h>
 #endif
 
+#include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
 
@@ -521,7 +522,7 @@
         len = sizeof (err);
         _lm_sock_get_error (fd, &err, &len);
         if (!_lm_sock_is_blocking_error (err)) {
-            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
+            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
                    "Connection failed.\n");
 
             /* error condition, but might be possible to recover
@@ -567,7 +568,7 @@
 #endif
     {
         /* for blocking sockets, G_IO_OUT means we are connected */
-        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_NET,
+        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
                "Connection success (2).\n");
 
         _lm_old_socket_succeeded (connect_data);
@@ -764,6 +765,9 @@
                              gpointer          user_data)
 {
     LmOldSocket *socket = (LmOldSocket *) user_data;
+    char dispbuf[128];
+    struct sockaddr_in *addr; /* FIXME:IPv6 */
+    const char *converr;
 
     lm_verbose ("LmOldSocket::host_cb (result=%d)\n", result);
 
@@ -784,7 +788,16 @@
     socket->connect_data->current_addr =
         lm_resolver_results_get_next (resolver);
 
-    if (socket->connect_data->current_addr) {
+    if (socket->connect_data->current_addr) { /* FIXME:IPv6 */
+        addr = (struct sockaddr_in *) (socket->connect_data->current_addr->ai_addr);
+        converr = inet_ntop(AF_INET,&(addr->sin_addr),dispbuf,sizeof(dispbuf));
+        if (converr) {
+            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
+                   "Attempting Connection to %s\n",dispbuf);
+        } else {
+            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
+                   "Attempting Connection (unable to convert address to presentable format)\n");
+        };
         socket_do_connect (socket->connect_data);
     } else { /* FIXME: IPv6 Support? */
         g_log (LM_LOG_DOMAIN,G_LOG_LEVEL_ERROR,
--- a/loudmouth/lm-resolver.c	Mon Feb 23 23:09:45 2009 -0800
+++ b/loudmouth/lm-resolver.c	Tue Feb 24 15:34:31 2009 -0800
@@ -384,13 +384,19 @@
     priv = GET_PRIV (resolver);
 
 skipresult:
-    if (!priv->current_result)
+    if (!priv->current_result) {
+        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
+               "no more results from resolver\n");
         return NULL;
+    };
 
     ret_val = priv->current_result;
     priv->current_result = priv->current_result->ai_next;
-    if (ret_val->ai_family != AF_INET) /* FIXME: we only support IPv4 for now */
+    if (ret_val->ai_family != AF_INET) {
+        g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_VERBOSE,
+               "skipping non-IPv4 resolver entry\n");
         goto skipresult;
+    };
 
     return ret_val;
 }