Mittler von vor27b97335haben keine Riss-Wache. hand/tisch_neu_verbinden.py erkennt den Riss am Ende des table_<nr>.log, findet im Mittler den Server-Griff der Pipe, an der der Unity-Tisch haengt (GetNamedPipeClientProcessId), und schliesst ihn (DUPLICATE_CLOSE_SOURCE) - wie riss_heilen. Live 15.11. 22:40: sechs eingefrorene Tische so geheilt, alle spielen wieder. --wache wiederholt das alle 10 s nur fuer alte Mittler (hoechstens 3 je Tisch in 10 Min) und endet, wenn keiner mehr laeuft. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit1a6fe30853)
61 lines
2.6 KiB
Python
61 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Erkennt hand/tisch_neu_verbinden.py einen eingefrorenen Tisch am Tischlog - und nur ihn?
|
|
|
|
Rein: nur Logdateien im Temp-Ordner, keine Pipe, kein Prozess. Nur unter Windows (ctypes-Griffe).
|
|
|
|
python tests/tisch_neu_verbinden_spec.py -v
|
|
"""
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
|
|
HIER = os.path.dirname(os.path.abspath(__file__))
|
|
WURZEL = os.path.dirname(HIER)
|
|
for p in (os.path.join(WURZEL, "hand"), os.path.join(WURZEL, "lesen"), os.path.join(WURZEL, "client")):
|
|
if p not in sys.path:
|
|
sys.path.insert(0, p)
|
|
|
|
if sys.platform == "win32":
|
|
import tisch_neu_verbinden as t # noqa: E402
|
|
|
|
# Wie im echten table_1781849.log vom 15.11. 22:18:32
|
|
RISS = (b"[2026-11-15 22:17:26:647] [UNITY] -> Server:: Game Started\r\n"
|
|
b"[2026-11-15 22:18:32:717] [PIP] -> Exception frames - start: Newtonsoft.Json.JsonTextReader.ParseValue\r\n"
|
|
b"[2026-11-15 22:18:32:721] [ERROR] - Handled Exception : Newtonsoft.Json.JsonReaderException: Unexpected\r\n"
|
|
b" at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in <29e3>:0 \r\n"
|
|
b" at PBNamedPipe.H.Pipes.PipeConnection`1[T].<Start>b__37_0 () [0x00141] in <772d>:0 \r\n\r\n")
|
|
# Nach der Heilung: der Leser meldet das Trennen, danach laeuft der Tisch wieder
|
|
GEHEILT = (b"[2026-11-15 22:41:20:192] [PIP] -> Exception frames - start: PBNamedPipe.H.Pipes.IO.PipeStreamReader\r\n"
|
|
b"[2026-11-15 22:41:20:193] [ERROR] - Handled Exception : System.IO.IOException: Unable to read data.\r\n"
|
|
b" at PBNamedPipe.H.Pipes.IO.PipeStreamReader.ReadAsync () [0x000f5] in <772d>:0 \r\n"
|
|
b"[2026-11-15 22:41:20:288] [UNITY] -> FetchAppLanguageConfig\r\n")
|
|
|
|
|
|
@unittest.skipUnless(sys.platform == "win32", "nur Windows")
|
|
class Eingefroren(unittest.TestCase):
|
|
def pruefe(self, inhalt):
|
|
with tempfile.TemporaryDirectory() as d:
|
|
pfad = os.path.join(d, "table_1781849.log")
|
|
with open(pfad, "wb") as f:
|
|
f.write(inhalt)
|
|
return t.eingefroren(pfad)
|
|
|
|
def test_riss_am_ende_ist_eingefroren(self):
|
|
self.assertTrue(self.pruefe(RISS))
|
|
|
|
def test_nach_der_heilung_nicht_mehr(self):
|
|
self.assertFalse(self.pruefe(RISS + GEHEILT))
|
|
|
|
def test_ohne_riss_und_ohne_log(self):
|
|
self.assertFalse(self.pruefe(b"[2026-11-15 22:17:26:647] [UNITY] -> Server:: Game Started\r\n"))
|
|
self.assertFalse(t.eingefroren(os.path.join(tempfile.gettempdir(), "gibt_es_nicht_4711.log")))
|
|
|
|
def test_nummer_aus_dem_raum(self):
|
|
self.assertEqual(t.nummer("14R NL 0.01-0.02 EV-INRIT-(A) 1781849"), "1781849")
|
|
self.assertIsNone(t.nummer("Klon"))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|