aboutsummaryrefslogtreecommitdiffstats
path: root/test/rfc7231_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-08-05 18:19:40 +0200
committerLoïc Hoguin <[email protected]>2019-08-05 19:57:16 +0200
commit3aa6686497d29bf29bc2663e34155fec4a39dead (patch)
treede53d2686575184c1bae37d47227bfa508b16e92 /test/rfc7231_SUITE.erl
parent9429902d017929afca014af8cc7f4bbc07b63abe (diff)
downloadgun-3aa6686497d29bf29bc2663e34155fec4a39dead.tar.gz
gun-3aa6686497d29bf29bc2663e34155fec4a39dead.tar.bz2
gun-3aa6686497d29bf29bc2663e34155fec4a39dead.zip
Improve the test proxy loop to avoid a badmatch
Diffstat (limited to 'test/rfc7231_SUITE.erl')
-rw-r--r--test/rfc7231_SUITE.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/rfc7231_SUITE.erl b/test/rfc7231_SUITE.erl
index 6ef07fe..ece516b 100644
--- a/test/rfc7231_SUITE.erl
+++ b/test/rfc7231_SUITE.erl
@@ -112,11 +112,19 @@ do_proxy_loop(Transport, ClientSocket, OriginSocket) ->
{OK, _, _} = Transport:messages(),
receive
{OK, ClientSocket, Data} ->
- ok = gen_tcp:send(OriginSocket, Data),
- do_proxy_loop(Transport, ClientSocket, OriginSocket);
+ case gen_tcp:send(OriginSocket, Data) of
+ ok ->
+ do_proxy_loop(Transport, ClientSocket, OriginSocket);
+ {error, _} ->
+ ok
+ end;
{tcp, OriginSocket, Data} ->
- ok = Transport:send(ClientSocket, Data),
- do_proxy_loop(Transport, ClientSocket, OriginSocket);
+ case Transport:send(ClientSocket, Data) of
+ ok ->
+ do_proxy_loop(Transport, ClientSocket, OriginSocket);
+ {error, _} ->
+ ok
+ end;
{tcp_closed, _} ->
ok;
{ssl_closed, _} ->