Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A reworking of the tshark pcap loaders
This is an attempt to split the responsibilities of the loader from one giant struct into several structs with mostly distinct roles - there is still some coordination between them, of course. Furthermore, the original loader was re-used, so it was essentially a collection of global variables. Some of the consequences of this change are: - various UI handlers, invokved on loader events, are now run in the main UI goroutine. Every handler simply used app.Run() to make that happen anyway, so this is a simplification. These handlers are also run serially, not launched in parallel, guaranteeing an execution order. The exception are the error handlers - they still manually invoked app.Run() when needed. - UI handlers are also provided a simple enum to show the source of the invocation. This allows e.g. BeforeBegin() handlers to distinguish whether this is being called from the PSML loader, PDML loader, etc etc. This seemed simpler than muliplying the various handler interfaces (BeforeBeginPsml, BeforeBeginPdml, etc etc). - loaders only change state - Loading <-> NotLoading - in the main goroutine. This means I can safely query the loader state from anything else running in the main goroutine - no race condition. - Process lifetimes are managed from a dedicated goroutine per loader - so there is no race between termshark invoking kill on a tshark process and termshark calling Wait() on the same process.
- Loading branch information