virtalabs / tapirx

Free and open-source medical device discovery and identification
GNU General Public License v3.0
28 stars 8 forks source link

Don't rebuild the decoding stack for each packet #10

Open ransford opened 5 years ago

ransford commented 5 years ago

While experimenting with decoder stacks, I realized that we're reinitializing the decoder stack for each packet, in decodeLayers(). This works against the performance benefit of gopacket.NewDecodingLayerParser and is probably accidental.

The DecodingLayerParser & decoder stack ([]gopacket.LayerType{}) should be initialized once and either passed to decodeLayers() as pointers or stored in globals.