Skip to content

Disterl: dist_listen_min/max options#1493

Open
petermm wants to merge 1 commit intoatomvm:mainfrom
petermm:dist-min-max-poc
Open

Disterl: dist_listen_min/max options#1493
petermm wants to merge 1 commit intoatomvm:mainfrom
petermm:dist-min-max-poc

Conversation

@petermm
Copy link
Contributor

@petermm petermm commented Jan 26, 2025

Similar to erlang inet_dist_listen_min/max.
https://www.erlang.org/doc/apps/kernel/kernel_app.html#inet_dist_listen

Needed for certain gateways/port forwarding scenarios.

Namely running local Wokwi simulator and connecting to that.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

@petermm petermm marked this pull request as draft February 3, 2025 19:49
@petermm petermm force-pushed the dist-min-max-poc branch from c064507 to 1757a7d Compare May 9, 2025 07:25
@petermm petermm changed the base branch from feature/distributed-erlang to main May 9, 2025 07:27
@petermm petermm marked this pull request as ready for review May 9, 2025 08:23
@bettio bettio requested a review from pguyot December 24, 2025 14:10
@petermm
Copy link
Contributor Author

petermm commented Jan 27, 2026

@pguyot this was the telegram back then: https://t.me/atomvm/23124/27019 - would be great to have these options one way or another..

@petermm petermm force-pushed the dist-min-max-poc branch 2 times, most recently from 2ea072f to 4545b7d Compare February 17, 2026 08:47
@pguyot
Copy link
Collaborator

pguyot commented Feb 17, 2026

My only concern is that these options relate to IP-based modules only. We could move forward with this but at some point we should instead have something like a dist_opts or listen_opts parameter that would be passed as the second parameter of listen/2 for modules that support listen/2 (OTP only has listen/1).

@petermm petermm marked this pull request as draft February 17, 2026 12:20
Add listen/2 accepting a generic options map, making the interface
transport-agnostic. Port range iteration (dist_listen_min/dist_listen_max)
is handled inside socket_dist rather than net_kernel.

net_kernel passes dist_opts opaquely to ProtoDist:listen/2, so no
net_kernel changes are needed when adding future dist module options.

Usage:
  net_kernel:start(mynode, #{
      name_domain => shortnames,
      dist_opts => #{dist_listen_min => 9100, dist_listen_max => 9110}
  }).

Signed-off-by: Peter M <petermm@gmail.com>
@petermm petermm marked this pull request as ready for review February 17, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments