tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r995751 - in /tomcat/jk/trunk/native/common: jk_connect.c jk_connect.h
Date Fri, 10 Sep 2010 11:24:22 GMT
Author: mturk
Date: Fri Sep 10 11:24:22 2010
New Revision: 995751

URL: http://svn.apache.org/viewvc?rev=995751&view=rev
Log:
Log local socket address

Modified:
    tomcat/jk/trunk/native/common/jk_connect.c
    tomcat/jk/trunk/native/common/jk_connect.h

Modified: tomcat/jk/trunk/native/common/jk_connect.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_connect.c?rev=995751&r1=995750&r2=995751&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_connect.c (original)
+++ tomcat/jk/trunk/native/common/jk_connect.c Fri Sep 10 11:24:22 2010
@@ -496,7 +496,7 @@ jk_sock_t jk_open_socket(struct sockaddr
                    "failed setting SIO_KEEPALIVE_VALS (errno=%d)", errno);
             jk_close_socket(sd, l);
             JK_TRACE_EXIT(l);
-            return JK_INVALID_SOCKET;                                                
+            return JK_INVALID_SOCKET;
         }
         if (JK_IS_DEBUG_LEVEL(l))
             jk_log(l, JK_LOG_DEBUG,
@@ -718,9 +718,11 @@ int jk_shutdown_socket(jk_sock_t sd, jk_
     }
 
     save_errno = errno;
-    if (JK_IS_DEBUG_LEVEL(l))
-        jk_log(l, JK_LOG_DEBUG, "About to shutdown socket %d", sd);
-
+    if (JK_IS_DEBUG_LEVEL(l)) {
+        char buf[64];
+        jk_log(l, JK_LOG_DEBUG, "About to shutdown socket %d %s",
+               sd, jk_dump_sinfo(sd, buf));
+    }
     /* Shut down the socket for write, which will send a FIN
      * to the peer.
      */
@@ -935,6 +937,21 @@ char *jk_dump_hinfo(struct sockaddr_in *
     return buf;
 }
 
+char *jk_dump_sinfo(jk_sock_t sd, char *buf)
+{
+    struct sockaddr_in s_addr;
+    socklen_t          s_alen;
+
+    s_alen = sizeof(struct sockaddr);
+    if (getsockname(sd, (struct sockaddr *)&s_addr, &s_alen) == 0) {
+        return jk_dump_hinfo(&s_addr, buf);
+    }
+    else {
+        sprintf(buf, "???%d:%d", sd, errno);
+        return buf;
+    }
+}
+
 /** Wait for input event on socket until timeout
  * @param sd      socket to use
  * @param timeout wait timeout in milliseconds
@@ -989,7 +1006,7 @@ int jk_is_input_event(jk_sock_t sd, int 
         }
         errno = save_errno;
         JK_TRACE_EXIT(l);
-        return JK_FALSE;        
+        return JK_FALSE;
     }
     errno = 0;
     JK_TRACE_EXIT(l);

Modified: tomcat/jk/trunk/native/common/jk_connect.h
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_connect.h?rev=995751&r1=995750&r2=995751&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_connect.h (original)
+++ tomcat/jk/trunk/native/common/jk_connect.h Fri Sep 10 11:24:22 2010
@@ -54,6 +54,8 @@ int jk_tcp_socket_recvfull(jk_sock_t sd,
 
 char *jk_dump_hinfo(struct sockaddr_in *saddr, char *buf);
 
+char *jk_dump_sinfo(jk_sock_t sd, char *buf);
+
 int jk_is_input_event(jk_sock_t sd, int timeout, jk_logger_t *l);
 
 int jk_is_socket_connected(jk_sock_t sd, jk_logger_t *l);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message