Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

guid for a session was not used anywhere

  • Loading branch information...
commit dbc553829087e84e3facf943ab2ed53db4a8535b 1 parent 8dd06af
@majek majek authored
Showing with 4 additions and 21 deletions.
  1. +4 −4 src/sockjs_session.erl
  2. +0 −17 src/sockjs_util.erl
View
8 src/sockjs_session.erl
@@ -24,7 +24,7 @@
handle :: handle()}).
-define(ETS, sockjs_table).
--type(handle() :: {?MODULE, {binary(), pid()}}).
+-type(handle() :: {?MODULE, pid()}).
-include("sockjs_internal.hrl").
@@ -63,12 +63,12 @@ received(Messages, SessionId) ->
received(Messages, spid(SessionId)).
-spec send(iodata(), handle()) -> ok.
-send(Data, {?MODULE, {_, SPid}}) ->
+send(Data, {?MODULE, SPid}) ->
gen_server:cast(SPid, {send, Data}),
ok.
-spec close(non_neg_integer(), string(), handle()) -> ok.
-close(Code, Reason, {?MODULE, {_, SPid}}) ->
+close(Code, Reason, {?MODULE, SPid}) ->
gen_server:cast(SPid, {close, Code, Reason}),
ok.
@@ -172,7 +172,7 @@ init({SessionId, #service{callback = Callback,
disconnect_delay = DisconnectDelay,
heartbeat_tref = undefined,
heartbeat_delay = HeartbeatDelay,
- handle = {?MODULE, {sockjs_util:guid(), self()}}}}.
+ handle = {?MODULE, self()}}}.
handle_call({reply, Pid, _Multiple}, _From, State = #session{
View
17 src/sockjs_util.erl
@@ -1,7 +1,6 @@
-module(sockjs_util).
-export([rand32/0]).
--export([guid/0]).
-export([encode_frame/1]).
-export([url_escape/2]).
@@ -21,22 +20,6 @@ rand32() ->
end,
random:uniform(erlang:trunc(math:pow(2,32)))-1.
--spec guid() -> binary().
-guid() ->
- list_to_binary(
- safe_encode(
- erlang:md5(
- term_to_binary({rand32(), rand32(), rand32(), rand32()})
- ))).
-
-safe_encode(Binary) ->
- Base64 = base64:encode_to_string(Binary),
- %% Replace '+' and '/' if necessary
- lists:map(fun ($/) -> $-;
- ($+) -> $_;
- (C) -> C
- end, Base64).
-
-spec encode_frame(frame()) -> iodata().
encode_frame({open, nil}) ->
Please sign in to comment.
Something went wrong with that request. Please try again.