killing wineserver and doing wineserver wait on restart instead of killing manual processes. hopefully helps when nosteam client is stuck in connection crash
This commit is contained in:
parent
d3baa7e050
commit
3d49d8e4af
@ -252,17 +252,29 @@ function performCssRestart(reason) {
|
|||||||
containerRestarting = true;
|
containerRestarting = true;
|
||||||
broadcastQueueState();
|
broadcastQueueState();
|
||||||
|
|
||||||
|
// Use Wine's own proper teardown instead of pkill + a fixed sleep guess.
|
||||||
|
// `wineserver -k` signals every Wine process under this prefix to exit;
|
||||||
|
// `wineserver -w` BLOCKS until wineserver has actually fully released all
|
||||||
|
// its shared memory / locks / sockets, rather than gambling on a fixed
|
||||||
|
// delay being long enough. This is what previously let a fresh CSS
|
||||||
|
// instance start before the old one had genuinely finished tearing down,
|
||||||
|
// inheriting a wedged state and landing right back on the same stuck
|
||||||
|
// "Connecting to server..." screen even after repeated restarts.
|
||||||
|
// Wrapped in `timeout` so a manual restart can never hang indefinitely if
|
||||||
|
// wineserver somehow never exits — after 15s we give up waiting and
|
||||||
|
// proceed to relaunch anyway.
|
||||||
try {
|
try {
|
||||||
execSync(`docker exec ${CONTAINER} pkill -f "cstrike_win64.exe" || true`);
|
execSync(`docker exec ${CONTAINER} bash -c "wineserver -k; timeout 15 wineserver -w || true"`);
|
||||||
execSync(`docker exec ${CONTAINER} pkill -f "revLoader.exe" || true`);
|
console.log('[sig] CSS restart: wineserver fully torn down');
|
||||||
execSync(`docker exec ${CONTAINER} pkill -f "wineserver" || true`);
|
|
||||||
execSync(`docker exec ${CONTAINER} pkill -f "winedevice.exe" || true`);
|
|
||||||
console.log('[sig] CSS restart: processes killed');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('[sig] CSS restart: failed to kill CSS:', e.message);
|
console.error('[sig] CSS restart: wineserver teardown failed:', e.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
// No artificial delay needed here anymore — wineserver -w above already
|
||||||
|
// blocked until teardown was genuinely complete (or the 15s timeout was
|
||||||
|
// hit), so we can relaunch immediately rather than adding another
|
||||||
|
// arbitrary fixed wait on top of a real synchronization guarantee.
|
||||||
|
(() => {
|
||||||
try {
|
try {
|
||||||
execSync(`docker exec -d ${CONTAINER} bash -c "DISPLAY=:99 wine '/home/ubuntu/Counter-Strike Source/revLoader.exe'"`);
|
execSync(`docker exec -d ${CONTAINER} bash -c "DISPLAY=:99 wine '/home/ubuntu/Counter-Strike Source/revLoader.exe'"`);
|
||||||
console.log('[sig] CSS restart: relaunched');
|
console.log('[sig] CSS restart: relaunched');
|
||||||
@ -290,7 +302,7 @@ function performCssRestart(reason) {
|
|||||||
console.error('[sig] CSS restart: failed to focus new window:', e.message);
|
console.error('[sig] CSS restart: failed to focus new window:', e.message);
|
||||||
}
|
}
|
||||||
}, 8000);
|
}, 8000);
|
||||||
}, 2000);
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Periodic restart: controller handoffs no longer restart the game at all,
|
// Periodic restart: controller handoffs no longer restart the game at all,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user