version: 0.2.0
+ monitoring wsbus PID
This commit is contained in:
parent
052b0b25c7
commit
c98e8718a8
2 changed files with 4 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
|||
PROJECT = wsio
|
||||
PROJECT_DESCRIPTION = WebSocket IO
|
||||
PROJECT_VERSION = 0.1.0
|
||||
PROJECT_VERSION = 0.2.0
|
||||
|
||||
# By default templates indent with a single tab per indentation
|
||||
# level. Set this variable to the number of spaces you prefer:
|
||||
|
|
|
@ -40,9 +40,12 @@ websocket_info({send, <<Bin/binary>>}, S) ->
|
|||
{[{text, Bin}], S};
|
||||
websocket_info({send, List}, S) when is_list(List) ->
|
||||
{List, S};
|
||||
websocket_info({'DOWN', _, process, PID, _}, #{wsbus := PID} = S) ->
|
||||
{ok, S#{wsbus => nil, ref_wsbus => st:lookup(wsbus)}};
|
||||
websocket_info({_, {Ref, {error, notfound}}}, #{ref_wsbus := Ref} = S) ->
|
||||
{ok, S#{ref_wsbus => st:lookup(wsbus)}};
|
||||
websocket_info({_, {Ref, {ok, PID}}}, #{ref_wsbus := Ref} = S) ->
|
||||
erlang:monitor(process, PID),
|
||||
{ok, maps:remove(ref_wsbus, S#{wsbus => PID})};
|
||||
websocket_info(_, S) ->
|
||||
{ok, S}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue