several code fixes and cleanups, revival of the 'unknown' process

This commit is contained in:
Arnout Engelen
2004-08-30 15:54:11 +00:00
parent 3b5ac96754
commit 0518d27924
7 changed files with 38 additions and 26 deletions

View File

@@ -69,10 +69,11 @@ Connection::Connection (Packet * packet)
if (packet->Outgoing())
{
sent_packets->add(packet);
refpacket = new Packet (*packet);
} else {
recv_packets->add(packet);
refpacket = packet->newInverted();
}
refpacket = packet->newPacket ();
lastpacket = packet->time.tv_sec;
if (DEBUG)
std::cout << "New reference packet created at " << refpacket << std::endl;
@@ -103,14 +104,15 @@ void Connection::add (Packet * packet)
/* finds connection to which this packet belongs.
* a packet belongs to a connection if it matches
* to its reference packet */
/* the incoming and outgoing streams of a connection
* are 2 sepetate 'connections' in nethogs. */
Connection * findConnection (Packet * packet)
{
ConnList * current = connections;
Packet * invertedPacket = packet->newInverted();
while (current != NULL)
{
if (packet->match(current->val->refpacket))
/* the reference packet is always *outgoing* */
if ((packet->match(current->val->refpacket))
|| (invertedPacket->match(current->val->refpacket)))
return current->val;
current = current->next;