Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0383-kernel-Fix-gen_tcp_dist-example.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0383-kernel-Fix-gen_tcp_dist-example.patch of Package erlang
From 89b0bcc32ddb44373ce0c4b447f92ef52dacb5f9 Mon Sep 17 00:00:00 2001 From: Rickard Green <rickard@erlang.org> Date: Wed, 1 Jun 2022 14:28:25 +0200 Subject: [PATCH] [kernel] Fix gen_tcp_dist example --- .../examples/gen_tcp_dist/src/gen_tcp_dist.erl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/kernel/examples/gen_tcp_dist/src/gen_tcp_dist.erl b/lib/kernel/examples/gen_tcp_dist/src/gen_tcp_dist.erl index 9df8ab4f4c..b00de7a55e 100644 --- a/lib/kernel/examples/gen_tcp_dist/src/gen_tcp_dist.erl +++ b/lib/kernel/examples/gen_tcp_dist/src/gen_tcp_dist.erl @@ -38,7 +38,8 @@ %% -export([listen/1, accept/1, accept_connection/5, - setup/5, close/1, select/1, is_node_name/1]). + setup/5, close/1, select/1, is_node_name/1, + address/0]). %% Optional -export([setopts/2, getopts/2]). @@ -72,6 +73,12 @@ select(Node) -> _ -> false end. +%% ------------------------------------------------------------ +%% Get the address family that this distribution uses +%% ------------------------------------------------------------ +address() -> + get_tcp_address(). + %% ------------------------------------------------------------ %% Create the listen socket, i.e. the port that this erlang %% node is accessible through. @@ -344,9 +351,12 @@ split_node([], _, Ack) -> [lists:reverse(Ack)]. %% ------------------------------------------------------------ get_tcp_address(Socket) -> {ok, Address} = inet:sockname(Socket), + NetAddr = get_tcp_address(), + NetAddr#net_address{address = Address}. + +get_tcp_address() -> {ok, Host} = inet:gethostname(), #net_address { - address = Address, host = Host, protocol = tcp, family = inet -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor