mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 13:02:12 -07:00
misc: added debug panic for #500
This commit is contained in:
parent
80000ed737
commit
821f885332
1 changed files with 5 additions and 0 deletions
|
@ -62,6 +62,7 @@ func NewQueue(iface *network.Endpoint) (q *Queue, err error) {
|
||||||
q = &Queue{
|
q = &Queue{
|
||||||
Protos: sync.Map{},
|
Protos: sync.Map{},
|
||||||
Traffic: sync.Map{},
|
Traffic: sync.Map{},
|
||||||
|
Stats: Stats{},
|
||||||
Activities: make(chan Activity),
|
Activities: make(chan Activity),
|
||||||
|
|
||||||
writes: &sync.WaitGroup{},
|
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) {
|
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.PktReceived, 1)
|
||||||
atomic.AddUint64(&q.Stats.Received, size)
|
atomic.AddUint64(&q.Stats.Received, size)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue