JBoss Native SVN: r1003 - trunk/sight/native/share.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-10 02:44:23 -0400 (Mon, 10 Sep 2007)
New Revision: 1003
Modified:
trunk/sight/native/share/udpconn.c
Log:
Use correct field types
Modified: trunk/sight/native/share/udpconn.c
===================================================================
--- trunk/sight/native/share/udpconn.c 2007-09-10 06:41:08 UTC (rev 1002)
+++ trunk/sight/native/share/udpconn.c 2007-09-10 06:44:23 UTC (rev 1003)
@@ -138,7 +138,7 @@
SET_IFIELD_J(0003, _O, val);
}
-void sight_udpconn_set_tmo(SIGHT_STDARGS, jlong val)
+void sight_udpconn_set_tmo(SIGHT_STDARGS, jint val)
{
SET_IFIELD_I(0004, _O, val);
}
17 years, 4 months
JBoss Native SVN: r1002 - trunk/sight/native/share.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-10 02:41:08 -0400 (Mon, 10 Sep 2007)
New Revision: 1002
Modified:
trunk/sight/native/share/tcpconn.c
trunk/sight/native/share/udpconn.c
Log:
Use correct field types
Modified: trunk/sight/native/share/tcpconn.c
===================================================================
--- trunk/sight/native/share/tcpconn.c 2007-09-10 06:37:05 UTC (rev 1001)
+++ trunk/sight/native/share/tcpconn.c 2007-09-10 06:41:08 UTC (rev 1002)
@@ -140,7 +140,7 @@
void sight_tcpconn_set_tmo(SIGHT_STDARGS, jint val)
{
- SET_IFIELD_J(0004, _O, val);
+ SET_IFIELD_I(0004, _O, val);
}
void sight_tcpconn_set_state(SIGHT_STDARGS, jint val)
Modified: trunk/sight/native/share/udpconn.c
===================================================================
--- trunk/sight/native/share/udpconn.c 2007-09-10 06:37:05 UTC (rev 1001)
+++ trunk/sight/native/share/udpconn.c 2007-09-10 06:41:08 UTC (rev 1002)
@@ -140,7 +140,7 @@
void sight_udpconn_set_tmo(SIGHT_STDARGS, jlong val)
{
- SET_IFIELD_J(0004, _O, val);
+ SET_IFIELD_I(0004, _O, val);
}
void sight_udpconn_set_state(SIGHT_STDARGS, jint val)
17 years, 4 months
JBoss Native SVN: r1001 - trunk/sight/java/org/jboss/sight.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-10 02:37:05 -0400 (Mon, 10 Sep 2007)
New Revision: 1001
Modified:
trunk/sight/java/org/jboss/sight/UdpConnection.java
Log:
Add missig field
Modified: trunk/sight/java/org/jboss/sight/UdpConnection.java
===================================================================
--- trunk/sight/java/org/jboss/sight/UdpConnection.java 2007-09-10 06:33:22 UTC (rev 1000)
+++ trunk/sight/java/org/jboss/sight/UdpConnection.java 2007-09-10 06:37:05 UTC (rev 1001)
@@ -56,6 +56,11 @@
public NetworkAddress RemoteAddr;
/**
+ * Specifies the state of the UDP connection
+ */
+ public UdpState State;
+
+ /**
* The PID of the process that issued a context bind for
* this endpoint.
*/
17 years, 4 months
JBoss Native SVN: r1000 - in trunk/sight: native/include and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-10 02:33:22 -0400 (Mon, 10 Sep 2007)
New Revision: 1000
Added:
trunk/sight/java/org/jboss/sight/UdpState.java
Modified:
trunk/sight/java/org/jboss/sight/UdpConnection.java
trunk/sight/native/include/sight_local.h
trunk/sight/native/share/udpconn.c
Log:
Add missing fields to UdpConnection
Modified: trunk/sight/java/org/jboss/sight/UdpConnection.java
===================================================================
--- trunk/sight/java/org/jboss/sight/UdpConnection.java 2007-09-10 05:51:00 UTC (rev 999)
+++ trunk/sight/java/org/jboss/sight/UdpConnection.java 2007-09-10 06:33:22 UTC (rev 1000)
@@ -40,12 +40,22 @@
// Nothing
}
+ private void setState(int state)
+ {
+ State = UdpState.valueOf(state);
+ }
+
/**
* Local IP address for the UDP endpoint.
*/
public NetworkAddress LocalAddr;
/**
+ * Specifies the address for the connection on the remote computer.
+ */
+ public NetworkAddress RemoteAddr;
+
+ /**
* The PID of the process that issued a context bind for
* this endpoint.
*/
Added: trunk/sight/java/org/jboss/sight/UdpState.java
===================================================================
--- trunk/sight/java/org/jboss/sight/UdpState.java (rev 0)
+++ trunk/sight/java/org/jboss/sight/UdpState.java 2007-09-10 06:33:22 UTC (rev 1000)
@@ -0,0 +1,58 @@
+/*
+ * SIGHT - System information gathering hybrid tool
+ *
+ * Copyright(c) 2007 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ */
+
+package org.jboss.sight;
+
+/**
+ * Determines the state of UDP connection
+ */
+public enum UdpState
+{
+
+ UNKNOWN( 0),
+ LISTENING( 1),
+ ESTABLISHED( 2);
+
+ private int value;
+ private UdpState(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static UdpState valueOf(int value)
+ {
+ for (UdpState e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ return UNKNOWN;
+ }
+
+}
Property changes on: trunk/sight/java/org/jboss/sight/UdpState.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/sight/native/include/sight_local.h
===================================================================
--- trunk/sight/native/include/sight_local.h 2007-09-10 05:51:00 UTC (rev 999)
+++ trunk/sight/native/include/sight_local.h 2007-09-10 06:33:22 UTC (rev 1000)
@@ -454,9 +454,11 @@
jobject sight_new_udpconn_class(SIGHT_STDARGS);
jobjectArray sight_new_udpconn_array(SIGHT_STDARGS, jsize);
void sight_udpconn_set_local(SIGHT_STDARGS, jobject);
+void sight_udpconn_set_remote(SIGHT_STDARGS, jobject);
void sight_udpconn_set_pid(SIGHT_STDARGS, jint);
void sight_udpconn_set_cts(SIGHT_STDARGS, jlong);
void sight_udpconn_set_tmo(SIGHT_STDARGS, jint);
+void sight_udpconn_set_state(SIGHT_STDARGS, jint);
#ifdef __cplusplus
Modified: trunk/sight/native/share/udpconn.c
===================================================================
--- trunk/sight/native/share/udpconn.c 2007-09-10 05:51:00 UTC (rev 999)
+++ trunk/sight/native/share/udpconn.c 2007-09-10 06:33:22 UTC (rev 1000)
@@ -46,6 +46,12 @@
"()V"
};
+J_DECLARE_M_ID(0001) = {
+ NULL,
+ "setState",
+ "(I)V"
+};
+
J_DECLARE_F_ID(0000) = {
NULL,
"LocalAddr",
@@ -54,17 +60,23 @@
J_DECLARE_F_ID(0001) = {
NULL,
+ "RemoteAddr",
+ "L" SIGHT_CLASS_PATH "NetworkAddress;"
+};
+
+J_DECLARE_F_ID(0002) = {
+ NULL,
"Pid",
"I"
};
-J_DECLARE_F_ID(0002) = {
+J_DECLARE_F_ID(0003) = {
NULL,
"CreateTimestamp",
"J"
};
-J_DECLARE_F_ID(0003) = {
+J_DECLARE_F_ID(0004) = {
NULL,
"Timeout",
"I"
@@ -78,7 +90,9 @@
J_LOAD_IFIELD(0001);
J_LOAD_IFIELD(0002);
J_LOAD_IFIELD(0003);
+ J_LOAD_IFIELD(0004);
J_LOAD_METHOD(0000);
+ J_LOAD_METHOD(0001);
return 0;
}
@@ -109,17 +123,27 @@
SET_IFIELD_O(0000, _O, val);
}
+void sight_udpconn_set_remote(SIGHT_STDARGS, jobject val)
+{
+ SET_IFIELD_O(0001, _O, val);
+}
+
void sight_udpconn_set_pid(SIGHT_STDARGS, jint val)
{
- SET_IFIELD_I(0001, _O, val);
+ SET_IFIELD_I(0002, _O, val);
}
void sight_udpconn_set_cts(SIGHT_STDARGS, jlong val)
{
- SET_IFIELD_J(0002, _O, val);
+ SET_IFIELD_J(0003, _O, val);
}
void sight_udpconn_set_tmo(SIGHT_STDARGS, jlong val)
{
- SET_IFIELD_J(0003, _O, val);
+ SET_IFIELD_J(0004, _O, val);
}
+
+void sight_udpconn_set_state(SIGHT_STDARGS, jint val)
+{
+ CALL_METHOD1(0001, _O, val);
+}
17 years, 4 months
JBoss Native SVN: r999 - trunk/sight/native/os/linux.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-10 01:51:00 -0400 (Mon, 10 Sep 2007)
New Revision: 999
Modified:
trunk/sight/native/os/linux/tcpstat.c
Log:
Use Timeout field for timelen
Modified: trunk/sight/native/os/linux/tcpstat.c
===================================================================
--- trunk/sight/native/os/linux/tcpstat.c 2007-09-10 05:45:27 UTC (rev 998)
+++ trunk/sight/native/os/linux/tcpstat.c 2007-09-10 05:51:00 UTC (rev 999)
@@ -341,7 +341,7 @@
char ras[128] = "";
char ssi[32] = "";
struct in_addr ial, iar;
- jlong cts = 0;
+ jint cts = 0;
unsigned long rxq, txq, timelen, retr, inode;
int num, d, uid, timer_run, timeout;
char more[512];
@@ -401,9 +401,12 @@
ras[0] = '\0';
}
/* TODO: See what's the actual value of timelen */
- cts = timelen;
+ tmo = timelen;
+ sight_tcpconn_set_tmo(_E, conn, tmo);
+ /* TODO: Search for create timestamp and pid by browsing
+ * the /proc/pid/fd for matching inode
+ */
sight_tcpconn_set_pid(_E, conn, pid);
- sight_tcpconn_set_cts(_E, conn, cts);
sight_tcpconn_set_state(_E, conn, tcp2sstate[state & 0xFF]);
la = sight_new_netaddr_class(_E, _O);
17 years, 4 months
JBoss Native SVN: r998 - in trunk/sight/native: share and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-10 01:45:27 -0400 (Mon, 10 Sep 2007)
New Revision: 998
Modified:
trunk/sight/native/include/sight_local.h
trunk/sight/native/share/tcpconn.c
trunk/sight/native/share/udpconn.c
Log:
Added Connection timeout field setters
Modified: trunk/sight/native/include/sight_local.h
===================================================================
--- trunk/sight/native/include/sight_local.h 2007-09-10 05:41:53 UTC (rev 997)
+++ trunk/sight/native/include/sight_local.h 2007-09-10 05:45:27 UTC (rev 998)
@@ -447,6 +447,7 @@
void sight_tcpconn_set_remote(SIGHT_STDARGS, jobject);
void sight_tcpconn_set_pid(SIGHT_STDARGS, jint);
void sight_tcpconn_set_cts(SIGHT_STDARGS, jlong);
+void sight_tcpconn_set_tmo(SIGHT_STDARGS, jint);
void sight_tcpconn_set_state(SIGHT_STDARGS, jint);
/* Prototypes from udpconn.c */
@@ -455,6 +456,7 @@
void sight_udpconn_set_local(SIGHT_STDARGS, jobject);
void sight_udpconn_set_pid(SIGHT_STDARGS, jint);
void sight_udpconn_set_cts(SIGHT_STDARGS, jlong);
+void sight_udpconn_set_tmo(SIGHT_STDARGS, jint);
#ifdef __cplusplus
Modified: trunk/sight/native/share/tcpconn.c
===================================================================
--- trunk/sight/native/share/tcpconn.c 2007-09-10 05:41:53 UTC (rev 997)
+++ trunk/sight/native/share/tcpconn.c 2007-09-10 05:45:27 UTC (rev 998)
@@ -76,6 +76,12 @@
"J"
};
+J_DECLARE_F_ID(0004) = {
+ NULL,
+ "Timeout",
+ "I"
+};
+
SIGHT_CLASS_LDEF(TcpConnection)
{
if (sight_load_class(_E, &_clazzn))
@@ -84,6 +90,7 @@
J_LOAD_IFIELD(0001);
J_LOAD_IFIELD(0002);
J_LOAD_IFIELD(0003);
+ J_LOAD_IFIELD(0004);
J_LOAD_METHOD(0000);
J_LOAD_METHOD(0001);
@@ -131,6 +138,11 @@
SET_IFIELD_J(0003, _O, val);
}
+void sight_tcpconn_set_tmo(SIGHT_STDARGS, jint val)
+{
+ SET_IFIELD_J(0004, _O, val);
+}
+
void sight_tcpconn_set_state(SIGHT_STDARGS, jint val)
{
CALL_METHOD1(0001, _O, val);
Modified: trunk/sight/native/share/udpconn.c
===================================================================
--- trunk/sight/native/share/udpconn.c 2007-09-10 05:41:53 UTC (rev 997)
+++ trunk/sight/native/share/udpconn.c 2007-09-10 05:45:27 UTC (rev 998)
@@ -64,6 +64,12 @@
"J"
};
+J_DECLARE_F_ID(0003) = {
+ NULL,
+ "Timeout",
+ "I"
+};
+
SIGHT_CLASS_LDEF(UdpConnection)
{
if (sight_load_class(_E, &_clazzn))
@@ -71,6 +77,7 @@
J_LOAD_IFIELD(0000);
J_LOAD_IFIELD(0001);
J_LOAD_IFIELD(0002);
+ J_LOAD_IFIELD(0003);
J_LOAD_METHOD(0000);
return 0;
@@ -111,3 +118,8 @@
{
SET_IFIELD_J(0002, _O, val);
}
+
+void sight_udpconn_set_tmo(SIGHT_STDARGS, jlong val)
+{
+ SET_IFIELD_J(0003, _O, val);
+}
17 years, 4 months
JBoss Native SVN: r997 - trunk/sight/java/org/jboss/sight.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-10 01:41:53 -0400 (Mon, 10 Sep 2007)
New Revision: 997
Modified:
trunk/sight/java/org/jboss/sight/TcpConnection.java
trunk/sight/java/org/jboss/sight/UdpConnection.java
Log:
Added Connection timeout fields
Modified: trunk/sight/java/org/jboss/sight/TcpConnection.java
===================================================================
--- trunk/sight/java/org/jboss/sight/TcpConnection.java 2007-09-09 09:57:16 UTC (rev 996)
+++ trunk/sight/java/org/jboss/sight/TcpConnection.java 2007-09-10 05:41:53 UTC (rev 997)
@@ -74,4 +74,10 @@
*/
public long CreateTimestamp;
+ /**
+ * Connection timeout value in miliseconds for the
+ * current connection State.
+ */
+ public int Timeout;
+
}
Modified: trunk/sight/java/org/jboss/sight/UdpConnection.java
===================================================================
--- trunk/sight/java/org/jboss/sight/UdpConnection.java 2007-09-09 09:57:16 UTC (rev 996)
+++ trunk/sight/java/org/jboss/sight/UdpConnection.java 2007-09-10 05:41:53 UTC (rev 997)
@@ -56,4 +56,11 @@
* bind operation that created this endpoint occurred.
*/
public long CreateTimestamp;
+
+ /**
+ * Connection timeout value in miliseconds for the
+ * current connection State.
+ */
+ public int Timeout;
+
}
17 years, 4 months
JBoss Native SVN: r996 - trunk/sight/native/os/windows.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-09 05:57:16 -0400 (Sun, 09 Sep 2007)
New Revision: 996
Modified:
trunk/sight/native/os/windows/udpstat.c
Log:
Check for memory failures
Modified: trunk/sight/native/os/windows/udpstat.c
===================================================================
--- trunk/sight/native/os/windows/udpstat.c 2007-09-09 09:52:24 UTC (rev 995)
+++ trunk/sight/native/os/windows/udpstat.c 2007-09-09 09:57:16 UTC (rev 996)
@@ -179,16 +179,15 @@
if (type == 0) {
DWORD dwSize = 0;
- e->p = malloc(sizeof(MIB_UDPTABLE));
+
+ if (!(e->p = sight_calloc(_E, sizeof(MIB_UDPTABLE),
+ THROW_FMARK)))
+ goto cleanup;
rc = GetUdpTable(e->p, &dwSize, TRUE);
if (rc == ERROR_INSUFFICIENT_BUFFER) {
free(e->p);
- e->p = malloc(dwSize);
- if (!e->p) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e->p = sight_calloc(_E, dwSize, THROW_FMARK)))
goto cleanup;
- }
}
else if (rc != NO_ERROR) {
throwAprException(_E, APR_FROM_OS_ERROR(rc));
@@ -203,17 +202,15 @@
}
else if (type == 1) {
DWORD dwSize = 0;
- e->p = malloc(sizeof(MIB_UDPTABLE_OWNER_MODULE));
+ if (!(e->p = sight_calloc(_E, sizeof(MIB_UDPTABLE_OWNER_MODULE),
+ THROW_FMARK)))
+ goto cleanup;
rc = GetExtendedUdpTable(e->p, &dwSize, TRUE, AF_INET,
UDP_TABLE_OWNER_MODULE, 0);
if (rc == ERROR_INSUFFICIENT_BUFFER) {
free(e->p);
- e->p = malloc(dwSize);
- if (!e->p) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e->p = sight_calloc(_E, dwSize, THROW_FMARK)))
goto cleanup;
- }
}
else if (rc != NO_ERROR) {
throwAprException(_E, APR_FROM_OS_ERROR(rc));
@@ -229,18 +226,17 @@
}
else if (type == 2) {
DWORD dwSize = 0;
- e->p = malloc(sizeof(MIB_UDP6TABLE_OWNER_MODULE));
+ if (!(e->p = sight_calloc(_E, sizeof(MIB_UDP6TABLE_OWNER_MODULE),
+ THROW_FMARK)))
+ goto cleanup;
+
rc = GetExtendedUdpTable(e->p, &dwSize, TRUE, AF_INET6,
UDP_TABLE_OWNER_MODULE, 0);
dwSize = dwSize << 2;
if (rc == ERROR_INSUFFICIENT_BUFFER) {
free(e->p);
- e->p = malloc(dwSize);
- if (!e->p) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e->p = sight_calloc(_E, dwSize, THROW_FMARK)))
goto cleanup;
- }
}
else if (rc != NO_ERROR) {
throwAprException(_E, APR_FROM_OS_ERROR(rc));
17 years, 4 months
JBoss Native SVN: r995 - trunk/sight/native/os/windows.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-09 05:52:24 -0400 (Sun, 09 Sep 2007)
New Revision: 995
Modified:
trunk/sight/native/os/windows/tcpstat.c
Log:
Check for memory failures
Modified: trunk/sight/native/os/windows/tcpstat.c
===================================================================
--- trunk/sight/native/os/windows/tcpstat.c 2007-09-09 09:36:15 UTC (rev 994)
+++ trunk/sight/native/os/windows/tcpstat.c 2007-09-09 09:52:24 UTC (rev 995)
@@ -250,16 +250,13 @@
if (type == 0) {
DWORD dwSize = 0;
- e->p = malloc(sizeof(MIB_TCPTABLE));
+ if (!(e->p = sight_calloc(_E, sizeof(MIB_TCPTABLE), THROW_FMARK)))
+ goto cleanup;
rc = GetTcpTable(e->p, &dwSize, TRUE);
if (rc == ERROR_INSUFFICIENT_BUFFER) {
free(e->p);
- e->p = malloc(dwSize);
- if (!e->p) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e->p = sight_calloc(_E, dwSize, THROW_FMARK)))
goto cleanup;
- }
}
else if (rc != NO_ERROR) {
throwAprException(_E, APR_FROM_OS_ERROR(rc));
@@ -274,17 +271,15 @@
}
else if (type == 1) {
DWORD dwSize = 0;
- e->p = malloc(sizeof(MIB_TCPTABLE_OWNER_MODULE));
+ if (!(e->p = sight_calloc(_E, sizeof(MIB_TCPTABLE_OWNER_MODULE),
+ THROW_FMARK)))
+ goto cleanup;
rc = GetExtendedTcpTable(e->p, &dwSize, TRUE, AF_INET,
TCP_TABLE_OWNER_MODULE_ALL, 0);
if (rc == ERROR_INSUFFICIENT_BUFFER) {
free(e->p);
- e->p = malloc(dwSize);
- if (!e->p) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e->p = sight_calloc(_E, dwSize, THROW_FMARK)))
goto cleanup;
- }
}
else if (rc != NO_ERROR) {
throwAprException(_E, APR_FROM_OS_ERROR(rc));
@@ -300,21 +295,16 @@
}
else if (type == 2) {
DWORD dwSize = 0;
- if (!(e->p = malloc(sizeof(MIB_TCP6TABLE_OWNER_MODULE)))) {
- throwAprException(_E, apr_get_os_error());
+ if (!(e->p = sight_calloc(_E, sizeof(MIB_TCP6TABLE_OWNER_MODULE),
+ THROW_FMARK)))
goto cleanup;
- }
rc = GetExtendedTcpTable(e->p, &dwSize, TRUE, AF_INET6,
TCP_TABLE_OWNER_MODULE_ALL, 0);
dwSize = dwSize << 2;
if (rc == ERROR_INSUFFICIENT_BUFFER) {
free(e->p);
- e->p = malloc(dwSize);
- if (!e->p) {
- throwAprMemoryException(_E, THROW_FMARK,
- apr_get_os_error());
+ if (!(e->p = sight_calloc(_E, dwSize, THROW_FMARK)))
goto cleanup;
- }
}
else if (rc != NO_ERROR) {
throwAprException(_E, APR_FROM_OS_ERROR(rc));
17 years, 4 months
JBoss Native SVN: r994 - trunk/sight/native/os/windows.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-09-09 05:36:15 -0400 (Sun, 09 Sep 2007)
New Revision: 994
Modified:
trunk/sight/native/os/windows/tcpstat.c
Log:
Fix garbage port for listening sockets
Modified: trunk/sight/native/os/windows/tcpstat.c
===================================================================
--- trunk/sight/native/os/windows/tcpstat.c 2007-09-09 09:20:58 UTC (rev 993)
+++ trunk/sight/native/os/windows/tcpstat.c 2007-09-09 09:36:15 UTC (rev 994)
@@ -390,10 +390,12 @@
strcpy(las, inet_ntoa(ial));
strcpy(ras, inet_ntoa(iar));
lp = ntohs((unsigned short)(0x0000FFFF & e->p4->table[index].dwLocalPort));
- rp = ntohs((unsigned short)(0x0000FFFF & e->p4->table[index].dwRemotePort));
+ rp = ntohs((unsigned short)(0x0000FFFF & e->p4->table[index].dwRemotePort));
state = e->p4->table[index].dwState;
pid = e->p4->table[index].dwOwningPid;
cts = litime_to_ms(&(e->p4->table[index].liCreateTimestamp));
+ if (state == MIB_TCP_STATE_LISTEN && e->p4->table[index].dwRemoteAddr == 0)
+ rp = 0;
}
else if (e->type == 2) {
sight_inet_ntop6(e->p6->table[index].ucLocalAddr, las, 64);
@@ -411,6 +413,8 @@
state = e->p6->table[index].dwState;
pid = e->p6->table[index].dwOwningPid;
cts = litime_to_ms(&(e->p6->table[index].liCreateTimestamp));
+ if (state == MIB_TCP_STATE_LISTEN)
+ rp = 0;
}
sight_tcpconn_set_pid(_E, conn, pid);
sight_tcpconn_set_cts(_E, conn, cts);
17 years, 4 months