diff options
author | Loïc Hoguin <[email protected]> | 2015-04-09 23:13:57 +0300 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-04-09 23:13:57 +0300 |
commit | a738db07c2040461f0fd431f04ecf90b157ead5b (patch) | |
tree | 3435489b45067c80fc7b7620cf02622676811c24 /test | |
parent | 2badb594bdedfd1283306fe2075c2c51abdd600d (diff) | |
download | gun-a738db07c2040461f0fd431f04ecf90b157ead5b.tar.gz gun-a738db07c2040461f0fd431f04ecf90b157ead5b.tar.bz2 gun-a738db07c2040461f0fd431f04ecf90b157ead5b.zip |
Add gun_up and gun_down messages
The flush(Pid) function was enhanced to also discard Websocket
messages and the new up/down messages.
Diffstat (limited to 'test')
-rw-r--r-- | test/ws_SUITE.erl | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index 2310b31..2df4329 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -120,6 +120,8 @@ loop(Pid, Ref) -> {gun_ws, Pid, Frame} -> gun:ws_send(Pid, Frame), loop(Pid, Ref); + {gun_down, Pid, ws, _, _, _} -> + close(Pid, Ref); {'DOWN', Ref, process, Pid, normal} -> close(Pid, Ref); Msg -> @@ -141,6 +143,12 @@ log_output() -> connect(Path) -> {ok, Pid} = gun:open("127.0.0.1", 33080, #{retry=>0}), + receive + {gun_up, Pid, http} -> + ok + after 1000 -> + error(open_timeout) + end, Ref = monitor(process, Pid), gun:ws_upgrade(Pid, Path, [], #{compress => true}), receive @@ -156,19 +164,7 @@ connect(Path) -> close(Pid, Ref) -> demonitor(Ref), gun:close(Pid), - flush(Pid). - -flush(Pid) -> - receive - {gun_ws, Pid, _} -> - flush(Pid); - {gun_ws_upgrade, Pid, _} -> - flush(Pid); - {'DOWN', _, process, Pid, _} -> - flush(Pid) - after 0 -> - ok - end. + gun:flush(Pid). terminate() -> Res = os:cmd("killall wstest"), |