aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2016-10-04 15:00:15 +0200
committerIngela Anderton Andin <[email protected]>2016-10-04 15:00:15 +0200
commitf98390d5100bf340bce2ede86be02955419f2c0a (patch)
tree259e90a23737f7f6af15a4b306aa1984118477d3 /lib
parent5618dedfe1da25c7941052cdc1bc648e22ad3fbe (diff)
parentdeab6591008dd5205e509aedb047a0745afe3775 (diff)
downloadotp-f98390d5100bf340bce2ede86be02955419f2c0a.tar.gz
otp-f98390d5100bf340bce2ede86be02955419f2c0a.tar.bz2
otp-f98390d5100bf340bce2ede86be02955419f2c0a.zip
Merge branch 'ingela/ssl/tests/ssl_packet_0_or_raw' into maint
* ingela/ssl/tests/ssl_packet_0_or_raw: ssl: Correct tests tcp stream handling
Diffstat (limited to 'lib')
-rw-r--r--lib/ssl/test/ssl_packet_SUITE.erl29
1 files changed, 11 insertions, 18 deletions
diff --git a/lib/ssl/test/ssl_packet_SUITE.erl b/lib/ssl/test/ssl_packet_SUITE.erl
index 81a49776e4..942e68967a 100644
--- a/lib/ssl/test/ssl_packet_SUITE.erl
+++ b/lib/ssl/test/ssl_packet_SUITE.erl
@@ -2011,26 +2011,19 @@ active_once_raw(Socket, Data, N) ->
active_once_raw(_, _, 0, _) ->
ok;
-active_once_raw(Socket, Data, N, Acc) ->
- receive
- {ssl, Socket, Byte} when length(Byte) == 1 ->
- ssl:setopts(Socket, [{active, once}]),
+active_once_raw(Socket, Data, N, Acc0) ->
+ case lists:prefix(Data, Acc0) of
+ true ->
+ DLen = length(Data),
+ Start = DLen + 1,
+ Len = length(Acc0) - DLen,
+ Acc = string:substr(Acc0, Start, Len),
+ active_once_raw(Socket, Data, N-1, Acc);
+ false ->
receive
- {ssl, Socket, _} ->
- ssl:setopts(Socket, [{active, once}]),
- active_once_raw(Socket, Data, N-1, [])
- end;
- {ssl, Socket, Data} ->
- ssl:setopts(Socket, [{active, once}]),
- active_once_raw(Socket, Data, N-1, []);
- {ssl, Socket, Other} ->
- case Acc ++ Other of
- Data ->
- ssl:setopts(Socket, [{active, once}]),
- active_once_raw(Socket, Data, N-1, []);
- NewAcc ->
+ {ssl, Socket, Info} ->
ssl:setopts(Socket, [{active, once}]),
- active_once_raw(Socket, Data, N, NewAcc)
+ active_once_raw(Socket, Data, N, Acc0 ++ Info)
end
end.