Replace ConnList linked list with multiset
Keeping a sorted multi-set allows faster search by source / source+destination address. Fixes O(n^2) complexity when handling a lot of connections (now it's O(n log n)).
This commit is contained in:
@@ -332,13 +332,10 @@ void show_trace(Line *lines[], int nproc) {
|
||||
}
|
||||
|
||||
/* print the 'unknown' connections, for debugging */
|
||||
ConnList *curr_unknownconn = unknowntcp->connections;
|
||||
while (curr_unknownconn != NULL) {
|
||||
for (auto it = unknowntcp->connections.begin(); it != unknowntcp->connections.end(); ++it) {
|
||||
std::cout << "Unknown connection: "
|
||||
<< curr_unknownconn->getVal()->refpacket->gethashstring()
|
||||
<< (*it)->refpacket->gethashstring()
|
||||
<< std::endl;
|
||||
|
||||
curr_unknownconn = curr_unknownconn->getNext();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user