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.Add(1)
|
||||
go func() {
|
||||
select {
|
||||
case <-h.quit:
|
||||
}
|
||||
<-h.quit
|
||||
h.quit = nil
|
||||
if h.taskQuit != nil {
|
||||
close(h.taskQuit)
|
||||
h.taskQuit = nil
|
||||
|
@ -93,7 +92,9 @@ func (h *Hevring) Die(x int, reply *FlutAck) error {
|
|||
go func() {
|
||||
fmt.Println("[hevring] Rán disconnected, stopping")
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
if h.quit != nil {
|
||||
close(h.quit)
|
||||
}
|
||||
}()
|
||||
reply.Ok = true
|
||||
return nil
|
||||
|
|
|
@ -133,6 +133,7 @@ func (r *Rán) handleExit(stopChan <-chan bool, wg *sync.WaitGroup) {
|
|||
ack := FlutAck{}
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue