diff options
author | Loïc Hoguin <[email protected]> | 2018-06-03 20:31:09 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-06-03 20:31:09 +0200 |
commit | 34307a584149abbf0b2e5b33beb2fca4c585b0d1 (patch) | |
tree | f44f3236287271ca0868262cb4401d1c1b88da38 /src/gun_ws_handler.erl | |
parent | ca57baf279a164c4b9813267e6bbc96ed5b45ee8 (diff) | |
download | gun-34307a584149abbf0b2e5b33beb2fca4c585b0d1.tar.gz gun-34307a584149abbf0b2e5b33beb2fca4c585b0d1.tar.bz2 gun-34307a584149abbf0b2e5b33beb2fca4c585b0d1.zip |
Change messages to gun_upgrade and gun_ws with stream reference
Diffstat (limited to 'src/gun_ws_handler.erl')
-rw-r--r-- | src/gun_ws_handler.erl | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/gun_ws_handler.erl b/src/gun_ws_handler.erl deleted file mode 100644 index 4356ab5..0000000 --- a/src/gun_ws_handler.erl +++ /dev/null @@ -1,35 +0,0 @@ -%% Copyright (c) 2017, Loïc Hoguin <[email protected]> -%% -%% Permission to use, copy, modify, and/or distribute this software for any -%% purpose with or without fee is hereby granted, provided that the above -%% copyright notice and this permission notice appear in all copies. -%% -%% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -%% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -%% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -%% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -%% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - --module(gun_ws_handler). - --export([init/3]). --export([handle/2]). - --record(state, { - reply_to :: pid(), - frag_buffer = <<>> :: binary() -}). - -init(ReplyTo, _, _) -> - #state{reply_to=ReplyTo}. - -handle({fragment, nofin, _, Payload}, State=#state{frag_buffer=SoFar}) -> - State#state{frag_buffer= << SoFar/binary, Payload/binary >>}; -handle({fragment, fin, Type, Payload}, State=#state{reply_to=ReplyTo, frag_buffer=SoFar}) -> - ReplyTo ! {gun_ws, self(), {Type, << SoFar/binary, Payload/binary >>}}, - State#state{frag_buffer= <<>>}; -handle(Frame, State=#state{reply_to=ReplyTo}) -> - ReplyTo ! {gun_ws, self(), Frame}, - State. |