Permalink
Browse files

Merge pull request #5 from datacompboy/master

Fix handshake_continue/4 api change to handshake_continue/3.
  • Loading branch information...
2 parents 63a72ed + 81213d4 commit 23b3942ffb7f81c83cd765cb6b7e0ff1de91fe40 @datacompboy datacompboy committed Mar 26, 2014
View
@@ -44,7 +44,6 @@
-callback handshake(#wstate{}) -> {'ok', iolist(), #wstate{}}.
-callback handshake_continue(WsCallback::fun(),
Acc::term(),
- Data::binary(),
State::wstate()) ->
{term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} |
@@ -167,7 +166,7 @@ check_headers(Headers, RequiredHeaders) ->
%% behaviour_info(callbacks) ->
%% [
%% {handshake, 1},
-%% {handshake_continue, 4},
+%% {handshake_continue, 3},
%% {handle_data, 4},
%% {format_send, 2}
%% ];
@@ -36,7 +36,7 @@
-vsn("0.9-dev").
%% API
--export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]).
+-export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).
-export([required_headers/0]).
@@ -70,13 +70,12 @@ handshake(#wstate{socket_mode = SocketMode, force_ssl = WsForceSsl, origin = Ori
-spec handshake_continue(WsCallback::fun(),
Acc::term(),
- Data::binary(),
State::wstate()) ->
{term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} |
{term(), 'continue', wstate()} |
{term(), 'continue', binary(), wstate()}.
-handshake_continue(_CB, _Acc0, _Data, _State) ->
+handshake_continue(_CB, _Acc0, _State) ->
erlang:error(should_not_happen).
%% ----------------------------------------------------------------------------------------------------------
@@ -36,7 +36,7 @@
-vsn("0.9-dev").
%% API
--export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]).
+-export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).
-export([required_headers/0]).
@@ -62,11 +62,11 @@ handshake(State) ->
%% ----------------------------------------------------------------------------------------------------------
%% Description: Callback finalize handshake
%% ----------------------------------------------------------------------------------------------------------
-handshake_continue(CB, Acc0, Data,
+handshake_continue(CB, Acc0,
#wstate{socket_mode = SocketMode, force_ssl = WsForceSsl, headers = Headers, path = Path, origin = Origin, host = Host, buffer = Buffer} = State) ->
Key1 = proto_ws_utility:header_get_value('Sec-WebSocket-Key1', Headers),
Key2 = proto_ws_utility:header_get_value('Sec-WebSocket-Key2', Headers),
- case <<Buffer/binary, Data/binary>> of
+ case <<Buffer/binary>> of
<<Body:8/binary, Rest/binary>> ->
WsMode = case SocketMode of
ssl -> "wss";
@@ -36,7 +36,7 @@
-vsn("0.9-dev").
%% API
--export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]).
+-export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).
-export([required_headers/0]).
@@ -64,14 +64,13 @@ handshake(State) ->
%% ----------------------------------------------------------------------------------------------------------
-spec handshake_continue(WsCallback::fun(),
Acc::term(),
- Data::binary(),
State::wstate()) ->
{term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} |
{term(), 'continue', wstate()} |
{term(), 'continue', binary(), wstate()}.
-handshake_continue(WsCallback, Acc0, Data, State) ->
- ?HYBI_COMMON:handshake_continue(WsCallback, Acc0, Data, State).
+handshake_continue(WsCallback, Acc0, State) ->
+ ?HYBI_COMMON:handshake_continue(WsCallback, Acc0, State).
%% ----------------------------------------------------------------------------------------------------------
%% Description: Callback to handle incomed data.
@@ -36,7 +36,7 @@
-vsn("0.9-dev").
%% API
--export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]).
+-export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).
-include("../include/proto_ws.hrl").
@@ -84,13 +84,12 @@ handshake(#wstate{headers = Headers} = State) ->
%% ----------------------------------------------------------------------------------------------------------
-spec handshake_continue(WsCallback::fun(),
Acc::term(),
- Data::binary(),
State::wstate()) ->
{term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} |
{term(), 'continue', wstate()} |
{term(), 'continue', binary(), wstate()}.
-handshake_continue(_CB, _Acc0, _Data, _State) ->
+handshake_continue(_CB, _Acc0, _State) ->
erlang:error(should_not_happen).
%% ----------------------------------------------------------------------------------------------------------
@@ -36,7 +36,7 @@
-vsn("0.9-dev").
%% API
--export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]).
+-export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).
-export([required_headers/0]).
@@ -64,14 +64,13 @@ handshake(State) ->
%% ----------------------------------------------------------------------------------------------------------
-spec handshake_continue(WsCallback::fun(),
Acc::term(),
- Data::binary(),
State::wstate()) ->
{term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} |
{term(), 'continue', wstate()} |
{term(), 'continue', binary(), wstate()}.
-handshake_continue(WsCallback, Acc0, Data, State) ->
- ?HYBI_COMMON:handshake_continue(WsCallback, Acc0, Data, State).
+handshake_continue(WsCallback, Acc0, State) ->
+ ?HYBI_COMMON:handshake_continue(WsCallback, Acc0, State).
%% ----------------------------------------------------------------------------------------------------------
%% Description: Callback to handle incomed data.

0 comments on commit 23b3942

Please sign in to comment.