diff options
author | Sverker Eriksson <sverker@erlang.org> | 2023-01-03 19:31:59 +0100 |
---|---|---|
committer | Sverker Eriksson <sverker@erlang.org> | 2023-01-17 21:04:26 +0100 |
commit | a6c7e00331c6945b843232b440ac80bc990a5bae (patch) | |
tree | 12d7d76ce3bc12f69087d61265e0f2a307e24277 /lib/erl_interface/test/ei_tmo_SUITE.erl | |
parent | f9868795368a8e38e9c7bff261dd66e730015e35 (diff) | |
download | erlang-a6c7e00331c6945b843232b440ac80bc990a5bae.tar.gz |
erl_interface: Accept ver5 distribution connection setup
Partially reverts commit c804bd8c7f840ecfa2397c836235363c112d79b4.
Diffstat (limited to 'lib/erl_interface/test/ei_tmo_SUITE.erl')
-rw-r--r-- | lib/erl_interface/test/ei_tmo_SUITE.erl | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/lib/erl_interface/test/ei_tmo_SUITE.erl b/lib/erl_interface/test/ei_tmo_SUITE.erl index d0e5f4514a..7be5d38f0a 100644 --- a/lib/erl_interface/test/ei_tmo_SUITE.erl +++ b/lib/erl_interface/test/ei_tmo_SUITE.erl @@ -146,6 +146,10 @@ do_one_recv_failure(Config,CNode) -> -define(EI_DIST_LOW, 6). -define(EI_DIST_HIGH, 6). +%% An OTP-23 or 24 node may connect assuming 5 or higher. +-define(EI_DIST_LOWEST_ASSUMED, 5). + + %% Check send with timeouts. ei_send_tmo(Config) when is_list(Config) -> register(ei_send_tmo_1,self()), @@ -303,6 +307,15 @@ ei_connect_tmo(Config) when is_list(Config) -> %% Check accept with timeouts. ei_accept_tmo(Config) when is_list(Config) -> + [begin + io:format("Test assumed ver=~p\n", + [AssumedVer]), + do_ei_accept_tmo(Config, AssumedVer) + end + || AssumedVer <- lists:seq(?EI_DIST_LOWEST_ASSUMED, ?EI_DIST_HIGH)], + ok. + +do_ei_accept_tmo(Config, AssumedVer) -> Flags = ?COMPULSORY_DFLAGS bor ?DFLAG_MANDATORY_25_DIGEST, P = runner:start(Config, ?accept_tmo), @@ -323,11 +336,11 @@ ei_accept_tmo(Config) when is_list(Config) -> runner:recv_eot(P2), true = is_integer(X), - normal_accept(Config, Flags), + normal_accept(Config, AssumedVer, Flags), ok. -normal_accept(Config, Flags) -> +normal_accept(Config, AssumedVer, Flags) -> P = runner:start(Config, ?accept_tmo), runner:send_term(P,{c_nod_som_vi_kontaktar_2, erlang:get_cookie(), @@ -341,7 +354,7 @@ normal_accept(Config, Flags) -> {ok, SocketA} = gen_tcp:connect(atom_to_list(NB),PortNo, [{active,false}, {packet,2}]), - send_name(SocketA, OurName, Flags), + send_name(SocketA, OurName, AssumedVer, Flags), ok = recv_status(SocketA), {hidden,_Node,HisChallengeA} = recv_challenge(SocketA), % See 1) _OurChallengeA = gen_challenge(), @@ -401,13 +414,18 @@ make_and_check_dummy() -> %% Test that erl_interface sets the appropriate distributions flags. ei_dflags(Config) -> + AssumedVer = 5, + OurVer = 6, + %% Test compatibility with OTP 24 and earlier. normal_connect(Config, ?COMPULSORY_DFLAGS), - normal_accept(Config, ?COMPULSORY_DFLAGS), + normal_accept(Config, AssumedVer, ?COMPULSORY_DFLAGS), + normal_accept(Config, OurVer, ?COMPULSORY_DFLAGS), %% Test compatibility with future versions. normal_connect(Config, ?DFLAG_MANDATORY_25_DIGEST), - normal_accept(Config, ?DFLAG_MANDATORY_25_DIGEST), + normal_accept(Config, AssumedVer, ?DFLAG_MANDATORY_25_DIGEST), + normal_accept(Config, OurVer, ?DFLAG_MANDATORY_25_DIGEST), ok. @@ -558,14 +576,19 @@ send_challenge_ack(Socket, Digest) -> % ?shutdown(bad_challenge_ack) % end. -send_name(Socket, MyNode, Flags) -> +send_name(Socket, MyNode, AssumedVer, Flags0) -> + Flags = Flags0 bor?DFLAG_HANDSHAKE_23, NodeName = atom_to_binary(MyNode, latin1), - Creation = erts_internal:get_creation(), - ?to_port(Socket, [$N, - <<Flags:64, - Creation:32, - (byte_size(NodeName)):16>>, - NodeName]). + if AssumedVer =:= 5 -> + ?to_port(Socket, [$n,?int16(?EI_DIST_HIGH),?int32(Flags),NodeName]); + AssumedVer >= 6 -> + Creation = erts_internal:get_creation(), + ?to_port(Socket, [$N, + <<Flags:64, + Creation:32, + (byte_size(NodeName)):16>>, + NodeName]) + end. recv_name(Socket) -> case gen_tcp:recv(Socket, 0) of |