mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
fix: fixed a bug which prevented the first log messages not to be showed by the event.stream module
This commit is contained in:
parent
e0906c0afb
commit
3ed4db132c
1 changed files with 9 additions and 0 deletions
|
@ -58,6 +58,15 @@ func (p *EventPool) Listen() <-chan Event {
|
|||
p.Lock()
|
||||
defer p.Unlock()
|
||||
l := make(chan Event)
|
||||
|
||||
// make sure, without blocking, the new listener
|
||||
// will receive all the queued events
|
||||
go func() {
|
||||
for _, e := range p.events {
|
||||
l <- e
|
||||
}
|
||||
}()
|
||||
|
||||
p.listeners = append(p.listeners, l)
|
||||
return l
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue