partially fix exit race condition in local mode
This commit is contained in:
parent
4860070a6b
commit
5a25388d84
|
@ -27,9 +27,8 @@ func ConnectHevring(ránAddress string, stop chan bool, wg *sync.WaitGroup) {
|
||||||
h.wg = wg
|
h.wg = wg
|
||||||
h.wg.Add(1)
|
h.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
<-h.quit
|
||||||
case <-h.quit:
|
h.quit = nil
|
||||||
}
|
|
||||||
if h.taskQuit != nil {
|
if h.taskQuit != nil {
|
||||||
close(h.taskQuit)
|
close(h.taskQuit)
|
||||||
h.taskQuit = nil
|
h.taskQuit = nil
|
||||||
|
@ -93,7 +92,9 @@ func (h *Hevring) Die(x int, reply *FlutAck) error {
|
||||||
go func() {
|
go func() {
|
||||||
fmt.Println("[hevring] Rán disconnected, stopping")
|
fmt.Println("[hevring] Rán disconnected, stopping")
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
close(h.quit)
|
if h.quit != nil {
|
||||||
|
close(h.quit)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
reply.Ok = true
|
reply.Ok = true
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -133,6 +133,7 @@ func (r *Rán) handleExit(stopChan <-chan bool, wg *sync.WaitGroup) {
|
||||||
ack := FlutAck{}
|
ack := FlutAck{}
|
||||||
c.Call("Hevring.Die", 0, &ack) // @speed: async
|
c.Call("Hevring.Die", 0, &ack) // @speed: async
|
||||||
}
|
}
|
||||||
|
// FIXME: why the fuck are we quitting before this loop is complete?
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTask assigns a pixelflut.FlutTask to Rán, distributing it to all clients
|
// SetTask assigns a pixelflut.FlutTask to Rán, distributing it to all clients
|
||||||
|
|
Loading…
Reference in New Issue