Parse a verbose log file for local and remote candidate counts. Returns (local_dict, remote_dict) mapping candidate type -> count. Local = lines containing 'LocalCandidateAdded' (candidates this peer gathered). Remote = lines containing 'Got remote candidate' (candidates received
( filename )
| 354 | return [ '--mock-gateway', gateway, '--mock-nat', nat_type, '--mock-adapter', internal, '--mock-latency', str(latency_ms) ] |
| 355 | |
| 356 | def _parse_candidate_log( filename ): |
| 357 | """ |
| 358 | Parse a verbose log file for local and remote candidate counts. |
| 359 | Returns (local_dict, remote_dict) mapping candidate type -> count. |
| 360 | Local = lines containing 'LocalCandidateAdded' (candidates this peer gathered). |
| 361 | Remote = lines containing 'Got remote candidate' (candidates received from peer). |
| 362 | """ |
| 363 | local, remote = {}, {} |
| 364 | try: |
| 365 | with open( filename, 'rt', errors='replace' ) as f: |
| 366 | for line in f: |
| 367 | if 'LocalCandidateAdded' in line: |
| 368 | m = re.search( r'\btyp (\w+)', line ) |
| 369 | if m: |
| 370 | t = m.group(1) |
| 371 | local[t] = local.get(t, 0) + 1 |
| 372 | if 'Got remote candidate' in line: |
| 373 | m = re.search( r'\btyp (\w+)', line ) |
| 374 | if m: |
| 375 | t = m.group(1) |
| 376 | remote[t] = remote.get(t, 0) + 1 |
| 377 | except FileNotFoundError: |
| 378 | pass |
| 379 | return local, remote |
| 380 | |
| 381 | |
| 382 | # Address used for "server is down" tests: valid loopback IP but no STUN/TURN listening. |
no outgoing calls
no test coverage detected