Commit 526375e
committed
Allow binding to port 0 for OS-assigned ports
Add support for configuring listening addresses with port 0, letting
the OS pick a free port. After binding, the actual port is resolved
via local_addr() and stored in a new bound_listening_addresses field.
The listening_addresses() and announcement_addresses() getters now
return the resolved bound addresses when the node is running, falling
back to the configured addresses when stopped. The gossip broadcast
task also prefers resolved addresses.
This eliminates the need for the deterministic port picker in tests,
which was fragile due to potential port collisions. Tests now use
127.0.0.1:0 and query the actual port after start().
AI tools were used in preparing this commit.1 parent 3aef2b3 commit 526375e
4 files changed
Lines changed: 56 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1988 | 1988 | | |
1989 | 1989 | | |
1990 | 1990 | | |
| 1991 | + | |
1991 | 1992 | | |
1992 | 1993 | | |
1993 | 1994 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
406 | 436 | | |
407 | 437 | | |
408 | 438 | | |
| |||
478 | 508 | | |
479 | 509 | | |
480 | 510 | | |
| 511 | + | |
481 | 512 | | |
482 | 513 | | |
483 | 514 | | |
| |||
525 | 556 | | |
526 | 557 | | |
527 | 558 | | |
| 559 | + | |
| 560 | + | |
528 | 561 | | |
529 | 562 | | |
530 | 563 | | |
| |||
740 | 773 | | |
741 | 774 | | |
742 | 775 | | |
| 776 | + | |
743 | 777 | | |
744 | 778 | | |
745 | 779 | | |
| |||
842 | 876 | | |
843 | 877 | | |
844 | 878 | | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
845 | 883 | | |
846 | | - | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
847 | 889 | | |
848 | 890 | | |
849 | 891 | | |
850 | 892 | | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
| 893 | + | |
855 | 894 | | |
856 | 895 | | |
857 | 896 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
269 | 268 | | |
270 | 269 | | |
271 | 270 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | 271 | | |
283 | 272 | | |
284 | 273 | | |
| |||
302 | 291 | | |
303 | 292 | | |
304 | 293 | | |
305 | | - | |
| 294 | + | |
306 | 295 | | |
307 | 296 | | |
308 | 297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
1431 | 1432 | | |
1432 | 1433 | | |
1433 | 1434 | | |
1434 | | - | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
1435 | 1439 | | |
1436 | | - | |
1437 | 1440 | | |
1438 | 1441 | | |
1439 | 1442 | | |
| |||
1443 | 1446 | | |
1444 | 1447 | | |
1445 | 1448 | | |
1446 | | - | |
1447 | 1449 | | |
1448 | | - | |
1449 | 1450 | | |
1450 | 1451 | | |
1451 | 1452 | | |
| |||
1505 | 1506 | | |
1506 | 1507 | | |
1507 | 1508 | | |
| 1509 | + | |
1508 | 1510 | | |
1509 | 1511 | | |
1510 | 1512 | | |
| |||
0 commit comments