Need to run shutdown code, where is best?

asked 2019-07-01 19:20:14 +0000

Victor_jimenez gravatar image

Is there a standard place to put shutdown code in the wireshark codebase? There are some system resources that I need to request as part of my tap and I know where to initialize the request for those resources. But other than hacking the termination code and releasing the resources there, is there some sort of routine for either a dissector or tap that gets called on shutdown that would be a better place for releasing the resources?

This is for Window OS though I imagine it would be applicable to all OSes.

edit retag flag offensive close merge delete

Comments

So do you need to hold onto those resources until Wireshark exits? What happens if, for example, your tap displays a window, and the window is closed? What happens if the file on which the tap was run is closed?

Guy Harris gravatar imageGuy Harris ( 2019-07-01 21:25:04 +0000 )edit

Ideally, you should hold the resource until the tap is no longer needed. That way you can ensure a clean release. Wireshark doesn't seem to have a place to put this type of cleanup code into. I mean you could put it at the bottom of main(), I suppose, but that seems like an awful hack.

Victor_jimenez gravatar imageVictor_jimenez ( 2019-07-02 16:31:24 +0000 )edit