fix: fixed events buffering, now no event is lost with multiple listeners (fixes #266)

This commit is contained in:
evilsocket 2018-05-12 12:16:15 +02:00
parent e9fa015962
commit 9f0b4a9502
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
3 changed files with 25 additions and 21 deletions

View file

@ -17,15 +17,14 @@ import (
type RestAPI struct {
session.SessionModule
server *http.Server
username string
password string
certFile string
keyFile string
useWebsocket bool
upgrader websocket.Upgrader
eventListener <-chan session.Event
quit chan bool
server *http.Server
username string
password string
certFile string
keyFile string
useWebsocket bool
upgrader websocket.Upgrader
quit chan bool
}
func NewRestAPI(s *session.Session) *RestAPI {
@ -34,7 +33,6 @@ func NewRestAPI(s *session.Session) *RestAPI {
server: &http.Server{},
quit: make(chan bool),
useWebsocket: false,
eventListener: s.Events.Listen(),
upgrader: websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,