fix: fixed a bug which prevented the first log messages not to be showed by the event.stream module

This commit is contained in:
evilsocket 2018-09-20 14:02:56 +02:00
commit 3ed4db132c
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -58,6 +58,15 @@ func (p *EventPool) Listen() <-chan Event {
p.Lock() p.Lock()
defer p.Unlock() defer p.Unlock()
l := make(chan Event) 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) p.listeners = append(p.listeners, l)
return l return l
} }