Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions erts/doc/guides/alt_dist.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,16 @@ The following `#hs_data{}` record fields need to be set unless otherwise stated:
following signature:

```erlang
fun (DistCtrlr, Node, DHandle) -> void()
fun (DistCtrlr, Node, DHandle) -> void() |
fun (DistCtrlr, Node, DHandle, Context) -> void()
```

where `DistCtrlr` is the identifier of the distribution controller, `Node` is
the node name of the node connected at the other end, and `DHandle` is a
distribution handle needed by a distribution controller process when calling
the following BIFs:
the node name of the node connected at the other end. `Context` is a map of
`#{creation => Creation, flags => Flags}`, and `Creation` / `Flags` are the
node incarnation identifier / [capability flags](erl_dist_protocol.md#dflags)
of the node connected at the other end. `DHandle` is a distribution handle
needed by a distribution controller process when calling the following BIFs:

- `erlang:dist_ctrl_get_data/1`
- `erlang:dist_ctrl_get_data_notification/1`
Expand Down
8 changes: 7 additions & 1 deletion lib/kernel/src/dist_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ convert_flags(_Undefined) ->
f_getopts :: function() | 'undefined'}).

connection(#hs_data{other_node = Node,
other_creation = Creation,
other_flags = Flags,
socket = Socket,
f_address = FAddress,
f_setopts_pre_nodeup = FPreNodeup,
Expand All @@ -509,7 +511,11 @@ connection(#hs_data{other_node = Node,
ok ->
case HSData#hs_data.f_handshake_complete of
undefined -> ok;
HsComplete -> HsComplete(Socket, Node, DHandle)
HsComplete when is_function(HsComplete, 3) ->
HsComplete(Socket, Node, DHandle);
HsComplete when is_function(HsComplete, 4) ->
Context = #{creation => Creation, flags => Flags},
HsComplete(Socket, Node, DHandle, Context)
end,
con_loop(#state{kernel = HSData#hs_data.kernel_pid,
node = Node,
Expand Down
Loading