FIX worker close panic

This commit is contained in:
boyska 2017-07-24 00:03:44 +02:00
parent ed985a92e9
commit 044696b7a0

View file

@ -18,6 +18,7 @@ type Worker struct {
func NewWorker(conn net.Conn) Worker { func NewWorker(conn net.Conn) Worker {
w := Worker{Conn: conn} w := Worker{Conn: conn}
w.Update = make(chan interface{}, 10) w.Update = make(chan interface{}, 10)
w.Exit = make(chan interface{})
return w return w
} }
@ -42,8 +43,6 @@ func (w *Worker) Work() {
err := w.send(obj) err := w.send(obj)
if err != nil { if err != nil {
w.Conn.Close() w.Conn.Close()
close(w.Update)
close(w.Exit)
return return
} }
} }