mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
fix: using buffered channel for events (fixes #37)
This commit is contained in:
parent
c6ae496720
commit
5b46b8d941
1 changed files with 2 additions and 6 deletions
|
@ -47,7 +47,7 @@ type EventPool struct {
|
||||||
|
|
||||||
func NewEventPool(debug bool, silent bool) *EventPool {
|
func NewEventPool(debug bool, silent bool) *EventPool {
|
||||||
return &EventPool{
|
return &EventPool{
|
||||||
NewEvents: make(chan Event),
|
NewEvents: make(chan Event, 0xff),
|
||||||
debug: debug,
|
debug: debug,
|
||||||
silent: silent,
|
silent: silent,
|
||||||
events: make([]Event, 0),
|
events: make([]Event, 0),
|
||||||
|
@ -59,11 +59,7 @@ func (p *EventPool) Add(tag string, data interface{}) {
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
e := NewEvent(tag, data)
|
e := NewEvent(tag, data)
|
||||||
p.events = append([]Event{e}, p.events...)
|
p.events = append([]Event{e}, p.events...)
|
||||||
|
p.NewEvents <- e
|
||||||
select {
|
|
||||||
case p.NewEvents <- e:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *EventPool) Log(level int, format string, args ...interface{}) {
|
func (p *EventPool) Log(level int, format string, args ...interface{}) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue