mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 13:02:12 -07:00
goroutine references address overwritten in loop; pass-by-value
This commit is contained in:
parent
4dadc3f41b
commit
01d33415a6
1 changed files with 3 additions and 3 deletions
|
@ -112,15 +112,15 @@ func (p *EventPool) Add(tag string, data interface{}) {
|
|||
// broadcast the event to every listener
|
||||
for _, l := range p.listeners {
|
||||
// do not block!
|
||||
go func(ch *chan Event) {
|
||||
go func(ch chan Event) {
|
||||
// channel might be closed
|
||||
defer func() {
|
||||
if recover() != nil {
|
||||
|
||||
}
|
||||
}()
|
||||
*ch <- e
|
||||
}(&l)
|
||||
ch <- e
|
||||
}(l)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue