aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/test/ssl_basic_SUITE.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-01-10 17:29:26 +0100
committerIngela Anderton Andin <[email protected]>2013-01-10 17:29:26 +0100
commit12c4a0b0c8963c03806613bb73487fdc14733db9 (patch)
tree025ca02113c3c9eca7fda83ac4ca8fed6dc12970 /lib/ssl/test/ssl_basic_SUITE.erl
parent20c180d3f207993b004a0b574fd0150d95435a2d (diff)
parent31815429670948bf4e02bc388770d7f18045ec1f (diff)
downloadotp-12c4a0b0c8963c03806613bb73487fdc14733db9.tar.gz
otp-12c4a0b0c8963c03806613bb73487fdc14733db9.tar.bz2
otp-12c4a0b0c8963c03806613bb73487fdc14733db9.zip
Merge branch 'ia/ssl/gen-tcp-reusesaddr'
* ia/ssl/gen-tcp-reusesaddr: ssl: Add test for gen_tcp with reuseaddr as reference
Diffstat (limited to 'lib/ssl/test/ssl_basic_SUITE.erl')
-rw-r--r--lib/ssl/test/ssl_basic_SUITE.erl58
1 files changed, 51 insertions, 7 deletions
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl
index faed91e559..3dbbfb65a8 100644
--- a/lib/ssl/test/ssl_basic_SUITE.erl
+++ b/lib/ssl/test/ssl_basic_SUITE.erl
@@ -242,7 +242,8 @@ options_tests() ->
protocol_versions,
empty_protocol_versions,
ipv6,
- reuseaddr].
+ reuseaddr,
+ tcp_reuseaddr].
api_tests() ->
[connection_info,
@@ -3765,13 +3766,8 @@ reuseaddr(Config) when is_list(Config) ->
{from, self()},
{mfa, {ssl_test_lib, no_result, []}},
{options, [{active, false} | ClientOpts]}]),
- Monitor = erlang:monitor(process, Server),
ssl_test_lib:close(Server),
ssl_test_lib:close(Client),
- receive
- {'DOWN', Monitor, _, _, _} ->
- ok
- end,
Server1 =
ssl_test_lib:start_server([{node, ServerNode}, {port, Port},
@@ -3791,6 +3787,51 @@ reuseaddr(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
+tcp_reuseaddr(doc) ->
+ [""];
+
+tcp_reuseaddr(suite) ->
+ [];
+
+tcp_reuseaddr(Config) when is_list(Config) ->
+ {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
+ Server =
+ ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {transport, gen_tcp},
+ {mfa, {ssl_test_lib, no_result, []}},
+ {options, [{active, false}, {reuseaddr, true}]}]),
+ Port = ssl_test_lib:inet_port(Server),
+ Client =
+ ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {transport, gen_tcp},
+ {from, self()},
+ {mfa, {ssl_test_lib, no_result, []}},
+ {options, [{active, false}]}]),
+ ssl_test_lib:close(Server),
+ ssl_test_lib:close(Client),
+
+ Server1 =
+ ssl_test_lib:start_server([{node, ServerNode}, {port, Port},
+ {from, self()},
+ {transport, gen_tcp},
+ {mfa, {?MODULE, tcp_send_recv_result, []}},
+ {options, [{active, false}, {reuseaddr, true}]}]),
+ Client1 =
+ ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {from, self()},
+ {transport, gen_tcp},
+ {mfa, {?MODULE, tcp_send_recv_result, []}},
+ {options, [{active, false}]}]),
+
+ ssl_test_lib:check_result(Server1, ok, Client1, ok),
+ ssl_test_lib:close(Server1),
+ ssl_test_lib:close(Client1).
+
+%%--------------------------------------------------------------------
+
hibernate(doc) ->
["Check that an SSL connection that is started with option "
"{hibernate_after, 1000} indeed hibernates after 1000ms of "
@@ -4206,7 +4247,6 @@ new_server_wants_peer_cert(Config) when is_list(Config) ->
ssl_test_lib:close(Client),
ssl_test_lib:close(Client1).
-
%%--------------------------------------------------------------------
%%% Internal functions
%%--------------------------------------------------------------------
@@ -4214,6 +4254,10 @@ send_recv_result(Socket) ->
ssl:send(Socket, "Hello world"),
{ok,"Hello world"} = ssl:recv(Socket, 11),
ok.
+tcp_send_recv_result(Socket) ->
+ gen_tcp:send(Socket, "Hello world"),
+ {ok,"Hello world"} = gen_tcp:recv(Socket, 11),
+ ok.
send_recv_result_timeout_client(Socket) ->
{error, timeout} = ssl:recv(Socket, 11, 500),