Skip to content

Commit

Permalink
Fix a race condition a socket would closed before a task started
Browse files Browse the repository at this point in the history
  • Loading branch information
Azolo committed Aug 31, 2018
1 parent 794ba21 commit 88b1fd6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/websockex_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,16 @@ defmodule WebSockexTest do
# Really glad that I got those sys behaviors now
:sys.suspend(pid)

test_pid = self()

task =
Task.async(fn ->
send(test_pid, :task_started)
WebSockex.send_frame(pid, {:text, "hello"})
end)

assert_receive :task_started

:gen_tcp.shutdown(conn.socket, :write)

:sys.resume(pid)
Expand Down

0 comments on commit 88b1fd6

Please sign in to comment.