Commit 1eaf801
committed
ControlModeEngine(abstraction): Engine hooks for probe/switch
Clean up abstraction leaks by replacing isinstance(ControlModeEngine)
checks with hook methods in the base Engine class:
- Add probe_server_alive() hook: allows engines to check server liveness
without bootstrapping (ControlModeEngine does direct subprocess probe)
- Add can_switch_client() hook: allows engines to indicate if switch-client
is meaningful (ControlModeEngine checks for non-control clients)
- Update Server.is_alive() to use probe hook instead of isinstance
- Update Server.raise_if_dead() to use probe hook instead of isinstance
- Update Server.switch_client() to use hook directly (was via getattr)
- Fix thread join in close() to skip current thread during GC
This removes all isinstance(ControlModeEngine) checks from Server,
making the Engine abstraction clean and extensible.1 parent 1a76783 commit 1eaf801
File tree
3 files changed
+88
-18
lines changed- src/libtmux
- _internal/engines
3 files changed
+88
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
164 | 197 | | |
165 | 198 | | |
166 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
174 | 180 | | |
175 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
176 | 186 | | |
177 | 187 | | |
178 | 188 | | |
| |||
312 | 322 | | |
313 | 323 | | |
314 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
315 | 350 | | |
316 | 351 | | |
317 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
216 | | - | |
| 215 | + | |
217 | 216 | | |
218 | | - | |
219 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
220 | 221 | | |
| 222 | + | |
221 | 223 | | |
222 | 224 | | |
223 | 225 | | |
| |||
234 | 236 | | |
235 | 237 | | |
236 | 238 | | |
237 | | - | |
| 239 | + | |
238 | 240 | | |
239 | | - | |
240 | | - | |
241 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
242 | 245 | | |
243 | 246 | | |
244 | | - | |
245 | | - | |
| 247 | + | |
| 248 | + | |
246 | 249 | | |
247 | 250 | | |
248 | 251 | | |
| 252 | + | |
249 | 253 | | |
250 | 254 | | |
251 | 255 | | |
252 | 256 | | |
253 | | - | |
254 | 257 | | |
255 | 258 | | |
256 | 259 | | |
| |||
483 | 486 | | |
484 | 487 | | |
485 | 488 | | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
490 | 492 | | |
491 | 493 | | |
492 | 494 | | |
| |||
0 commit comments