mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-08 06:28:27 -04:00
core/wayland: fix fatal error handling when the socket becomes
unavailable
This commit is contained in:
@@ -108,10 +108,7 @@ func (sc *SharedContext) eventDispatcher() {
|
|||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
err := fmt.Errorf("FATAL: Wayland event dispatcher panic: %v", r)
|
err := fmt.Errorf("FATAL: Wayland event dispatcher panic: %v", r)
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
select {
|
sc.signalFatal(err)
|
||||||
case sc.fatalError <- err:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -141,6 +138,7 @@ func (sc *SharedContext) eventDispatcher() {
|
|||||||
continue
|
continue
|
||||||
case err != nil:
|
case err != nil:
|
||||||
log.Errorf("Poll error: %v", err)
|
log.Errorf("Poll error: %v", err)
|
||||||
|
sc.signalFatal(fmt.Errorf("wayland poll error: %w", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,6 +159,7 @@ func (sc *SharedContext) eventDispatcher() {
|
|||||||
|
|
||||||
if consecutiveErrors >= maxConsecutiveErrors {
|
if consecutiveErrors >= maxConsecutiveErrors {
|
||||||
log.Errorf("Fatal: Wayland connection unrecoverable after %d attempts. Exiting dispatcher.", maxConsecutiveErrors)
|
log.Errorf("Fatal: Wayland connection unrecoverable after %d attempts. Exiting dispatcher.", maxConsecutiveErrors)
|
||||||
|
sc.signalFatal(fmt.Errorf("wayland connection unrecoverable after %d dispatch failures: %w", maxConsecutiveErrors, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,6 +171,13 @@ func (sc *SharedContext) eventDispatcher() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sc *SharedContext) signalFatal(err error) {
|
||||||
|
select {
|
||||||
|
case sc.fatalError <- err:
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (sc *SharedContext) drainCmdQueue() {
|
func (sc *SharedContext) drainCmdQueue() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
|||||||
Reference in New Issue
Block a user