Author: mturk
Date: Fri Sep 10 17:45:59 2010
New Revision: 995898

URL: http://svn.apache.org/viewvc?rev=995898&view=rev
Log:
Log both local and remote address
Modified:
    tomcat/jk/trunk/native/common/jk_connect.c
    tomcat/jk/trunk/native/common/portable.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=995898&r1=995897&r2=995898&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_connect.c (original)
+++ tomcat/jk/trunk/native/common/jk_connect.c Fri Sep 10 17:45:59 2010
@@ -719,8 +719,8 @@ int jk_shutdown_socket(jk_sock_t sd, jk_
 
     save_errno = errno;
     if (JK_IS_DEBUG_LEVEL(l)) {
-        char buf[64];
-        jk_log(l, JK_LOG_DEBUG, "About to shutdown socket %d %s",
+        char buf[128];
+        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
@@ -940,16 +940,27 @@ char *jk_dump_hinfo(struct sockaddr_in *
 char *jk_dump_sinfo(jk_sock_t sd, char *buf)
 {
     struct sockaddr_in s_addr;
+    struct sockaddr_in r_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;
+        s_alen = sizeof(struct sockaddr);
+        if (getpeername(sd, (struct sockaddr *)&r_addr, &s_alen) == 0) {
+            unsigned long  laddr = (unsigned  
long)htonl(s_addr.sin_addr.s_addr);
+            unsigned short lport = (unsigned short)htons(s_addr.sin_port);
+            unsigned long  raddr = (unsigned  
long)htonl(r_addr.sin_addr.s_addr);
+            unsigned short rport = (unsigned short)htons(r_addr.sin_port);
+            sprintf(buf, "%d.%d.%d.%d:%d -> %d.%d.%d.%d:%d",
+                    (int)(laddr >> 24), (int)((laddr >> 16) & 0xff),
+                    (int)((laddr >> 8) & 0xff), (int)(laddr & 0xff), 
(int)lport,
+                    (int)(raddr >> 24), (int)((raddr >> 16) & 0xff),
+                    (int)((raddr >> 8) & 0xff), (int)(raddr & 0xff), 
(int)rport);
+            return buf;
+        }
     }
+    sprintf(buf, "error=%d", errno);
+    return buf;
 }
 
 /** Wait for input event on socket until timeout

Modified: tomcat/jk/trunk/native/common/portable.h
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/portable.h?rev=995898&r1=995897&r2=995898&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/portable.h (original)
+++ tomcat/jk/trunk/native/common/portable.h Fri Sep 10 17:45:59 2010
@@ -1,18 +1,110 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* On most platform this file is overwritten when doing configure */
-/* DON'T COMMIT THE FILE IT BREAKS windoze and Netware, commit the sample file 
*/
+/* common/portable.h.  Generated by configure.  */
+/* common/portable.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Have flock() */
+#define HAVE_FLOCK 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Have poll() */
+#define HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Have snprintf() */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/filio.h> header file. */
+/* #undef HAVE_SYS_FILIO_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Have vsnprintf() */
+#define HAVE_VSNPRINTF 1
+
+/* Name of package */
+#define PACKAGE "mod_jk"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* The size of a `char', as computed by sizeof. */
+#define SIZEOF_CHAR 1
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of a `longlong', as computed by sizeof. */
+#define SIZEOF_LONGLONG 0
+
+/* The size of a `long double', as computed by sizeof. */
+#define SIZEOF_LONG_DOUBLE 12
+
+/* The size of a `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG 8
+
+/* The size of pid_t */
+#define SIZEOF_PID_T 4
+
+/* The size of pthread_t */
+#define SIZEOF_PTHREAD_T 4
+
+/* The size of a `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to use SOCK_CLOEXEC with socket() */
+/* #undef USE_SOCK_CLOEXEC */
+
+/* Define to use SO_RCVTIMEO with setsockopt() */
+#define USE_SO_RCVTIMEO 1
+
+/* Define to use SO_SNDTIMEO with setsockopt() */
+#define USE_SO_SNDTIMEO 1
+
+/* Version number of package */
+#define VERSION "1.2.29"



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

Reply via email to