Commit 89a14f9
committed
[CWHandler] Fix 100% CPU usage and missing CWs on softcam restart
CPU bug: When the softcam restarts, the old socket gets closed but
read() returning 0 (EOF) was never handled in the CWHandler poll loop.
Additionally, POLLHUP was gated behind !(revents & POLLIN) which fails
when both flags are set on a closed socket. This caused an infinite
busy-loop: poll() -> read() -> 0 -> ignored -> poll() -> ...
Fix: Handle EOF (read==0) for both softcam_fd and proxy_fd paths, and
remove the POLLIN gate from POLLHUP/POLLERR handling.
CW bug: After softcam reconnect, the running channel never received
new CW keys. On reconnect (m_protocol3_established), distributeCAPMT()
was called before the Protocol-3 handshake, sending CAPMTs in legacy
format. The softcam processed these and started descrambling. The
subsequent Protocol-3 CAPMTs after SERVER_INFO were treated as
duplicates - no CW keys were sent.
Fix: On Protocol-3 reconnect, complete the handshake first before
distributing CAPMTs. processServerInfoPacket() already calls
distributeCAPMT() after the handshake completes.1 parent 0208ba8 commit 89a14f9
2 files changed
+52
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | 384 | | |
393 | 385 | | |
| 386 | + | |
| 387 | + | |
394 | 388 | | |
395 | 389 | | |
396 | 390 | | |
397 | 391 | | |
| 392 | + | |
| 393 | + | |
398 | 394 | | |
399 | 395 | | |
400 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
| |||
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
286 | 298 | | |
287 | 299 | | |
288 | 300 | | |
289 | | - | |
| 301 | + | |
290 | 302 | | |
291 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
292 | 307 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 308 | + | |
297 | 309 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
305 | 314 | | |
306 | | - | |
307 | 315 | | |
| 316 | + | |
308 | 317 | | |
309 | 318 | | |
310 | 319 | | |
| 320 | + | |
311 | 321 | | |
312 | 322 | | |
313 | 323 | | |
| |||
330 | 340 | | |
331 | 341 | | |
332 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
333 | 353 | | |
334 | 354 | | |
335 | 355 | | |
336 | | - | |
| 356 | + | |
337 | 357 | | |
338 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
339 | 361 | | |
340 | | - | |
341 | | - | |
342 | | - | |
| 362 | + | |
343 | 363 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
351 | 368 | | |
352 | 369 | | |
353 | 370 | | |
| |||
0 commit comments