When and why any thread would ever access the global SnifferDatabase object
GUI Main Thread | Sniffer Thread | Arper Thread |
READS
Reads from database when populating the dialogs for “Detailed MAC Info” and “Show All IP's”.
| READS WRITES Regularly reads from database to check if a particular MAC/IP/Port exists in the database. If the entry doesn't exist, it adds an entry to the database. |
NEVER |
The only pieces of code that ever write to the SnifferDatabase are:
SnifferDatabase::find_in_container_or_add()
SnifferDatabase::SubmitData_For_One_Direction() (the qty_ip members)
These methods internally lock the appropriate mutex before writing.
Here's how locking should work for the global SnifferDatabase object:
| GUI Main Thread | Sniffer Thread |
Lock when Reading | Yes | No |
Lock when Writing | (non-applicable) | Yes |