1
0
mirror of https://github.com/bettercap/bettercap.git synced 2025-03-12 04:36:03 -07:00

misc: added debug panic for

This commit is contained in:
evilsocket 2019-03-21 12:55:46 +01:00
parent 80000ed737
commit 821f885332
No known key found for this signature in database
GPG Key ID: 1564D7F30393A456

@ -62,6 +62,7 @@ func NewQueue(iface *network.Endpoint) (q *Queue, err error) {
q = &Queue{
Protos: sync.Map{},
Traffic: sync.Map{},
Stats: Stats{},
Activities: make(chan Activity),
writes: &sync.WaitGroup{},
@ -165,6 +166,10 @@ func (q *Queue) trackActivity(eth *layers.Ethernet, ip4 *layers.IPv4, address ne
}
func (q *Queue) TrackPacket(size uint64) {
// https://github.com/bettercap/bettercap/issues/500
if q == nil {
panic("track packet on nil queue!")
}
atomic.AddUint64(&q.Stats.PktReceived, 1)
atomic.AddUint64(&q.Stats.Received, size)
}