skip memcpy
This commit is contained in:
parent
1618ed7214
commit
1ad9678af8
|
@ -842,8 +842,8 @@ static int net_conn_get_udp_listen(sigar_t *sigar,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<count; i++) {
|
for (i=0; i<count; i++) {
|
||||||
mib_udpLsnEnt *entry = &entries[i];
|
|
||||||
sigar_net_connection_t *conn;
|
sigar_net_connection_t *conn;
|
||||||
|
mib_udpLsnEnt *entry = &entries[i];
|
||||||
|
|
||||||
SIGAR_NET_CONNLIST_GROW(connlist);
|
SIGAR_NET_CONNLIST_GROW(connlist);
|
||||||
conn = &connlist->data[connlist->number++];
|
conn = &connlist->data[connlist->number++];
|
||||||
|
@ -918,8 +918,8 @@ static int net_conn_get_tcp(sigar_t *sigar,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<count; i++) {
|
for (i=0; i<count; i++) {
|
||||||
|
sigar_net_connection_t *conn;
|
||||||
mib_tcpConnEnt *entry = &entries[i];
|
mib_tcpConnEnt *entry = &entries[i];
|
||||||
sigar_net_connection_t conn;
|
|
||||||
int state = entry->State;
|
int state = entry->State;
|
||||||
|
|
||||||
if (!(IS_TCP_SERVER(state, flags) ||
|
if (!(IS_TCP_SERVER(state, flags) ||
|
||||||
|
@ -928,61 +928,60 @@ static int net_conn_get_tcp(sigar_t *sigar,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SIGAR_NET_CONNLIST_GROW(connlist);
|
||||||
|
conn = &connlist->data[connlist->number++];
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case TCCLOSED:
|
case TCCLOSED:
|
||||||
conn.state = SIGAR_TCP_CLOSE;
|
conn->state = SIGAR_TCP_CLOSE;
|
||||||
break;
|
break;
|
||||||
case TCLISTEN:
|
case TCLISTEN:
|
||||||
conn.state = SIGAR_TCP_LISTEN;
|
conn->state = SIGAR_TCP_LISTEN;
|
||||||
break;
|
break;
|
||||||
case TCSYNSENT:
|
case TCSYNSENT:
|
||||||
conn.state = SIGAR_TCP_SYN_SENT;
|
conn->state = SIGAR_TCP_SYN_SENT;
|
||||||
break;
|
break;
|
||||||
case TCSYNRECEIVE:
|
case TCSYNRECEIVE:
|
||||||
conn.state = SIGAR_TCP_SYN_RECV;
|
conn->state = SIGAR_TCP_SYN_RECV;
|
||||||
break;
|
break;
|
||||||
case TCESTABLISED:
|
case TCESTABLISED:
|
||||||
conn.state = SIGAR_TCP_ESTABLISHED;
|
conn->state = SIGAR_TCP_ESTABLISHED;
|
||||||
break;
|
break;
|
||||||
case TCFINWAIT1:
|
case TCFINWAIT1:
|
||||||
conn.state = SIGAR_TCP_FIN_WAIT1;
|
conn->state = SIGAR_TCP_FIN_WAIT1;
|
||||||
break;
|
break;
|
||||||
case TCFINWAIT2:
|
case TCFINWAIT2:
|
||||||
conn.state = SIGAR_TCP_FIN_WAIT2;
|
conn->state = SIGAR_TCP_FIN_WAIT2;
|
||||||
break;
|
break;
|
||||||
case TCCLOSEWAIT:
|
case TCCLOSEWAIT:
|
||||||
conn.state = SIGAR_TCP_CLOSE_WAIT;
|
conn->state = SIGAR_TCP_CLOSE_WAIT;
|
||||||
break;
|
break;
|
||||||
case TCCLOSING:
|
case TCCLOSING:
|
||||||
conn.state = SIGAR_TCP_CLOSING;
|
conn->state = SIGAR_TCP_CLOSING;
|
||||||
break;
|
break;
|
||||||
case TCLASTACK:
|
case TCLASTACK:
|
||||||
conn.state = SIGAR_TCP_LAST_ACK;
|
conn->state = SIGAR_TCP_LAST_ACK;
|
||||||
break;
|
break;
|
||||||
case TCTIMEWAIT:
|
case TCTIMEWAIT:
|
||||||
conn.state = SIGAR_TCP_TIME_WAIT;
|
conn->state = SIGAR_TCP_TIME_WAIT;
|
||||||
break;
|
break;
|
||||||
case TCDELETETCB:
|
case TCDELETETCB:
|
||||||
default:
|
default:
|
||||||
conn.state = SIGAR_TCP_UNKNOWN;
|
conn->state = SIGAR_TCP_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn.local_port = (unsigned short)entry->LocalPort;
|
conn->local_port = (unsigned short)entry->LocalPort;
|
||||||
conn.remote_port = (unsigned short)entry->RemPort;
|
conn->remote_port = (unsigned short)entry->RemPort;
|
||||||
conn.type = SIGAR_NETCONN_TCP;
|
conn->type = SIGAR_NETCONN_TCP;
|
||||||
|
|
||||||
sigar_inet_ntoa(sigar, entry->LocalAddress,
|
sigar_inet_ntoa(sigar, entry->LocalAddress,
|
||||||
conn.local_address);
|
conn->local_address);
|
||||||
|
|
||||||
sigar_inet_ntoa(sigar, entry->RemAddress,
|
sigar_inet_ntoa(sigar, entry->RemAddress,
|
||||||
conn.remote_address);
|
conn->remote_address);
|
||||||
|
|
||||||
conn.send_queue = conn.receive_queue = SIGAR_FIELD_NOTIMPL;
|
conn->send_queue = conn->receive_queue = SIGAR_FIELD_NOTIMPL;
|
||||||
|
|
||||||
SIGAR_NET_CONNLIST_GROW(connlist);
|
|
||||||
memcpy(&connlist->data[connlist->number++],
|
|
||||||
&conn, sizeof(conn));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(entries);
|
free(entries);
|
||||||
|
|
Loading…
Reference in New Issue