FIX worker close panic
This commit is contained in:
parent
ed985a92e9
commit
044696b7a0
1 changed files with 1 additions and 2 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue