Permalink
Browse files

Merge pull request #7 from ferd/lance-bass

Fix potential connection error
  • Loading branch information...
jkvor committed Apr 2, 2013
2 parents 4f67336 + 3fc9753 commit 84ebe67917ea3b013e1b47417c4a63b66f100f78
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/nsync.erl
View
@@ -77,16 +77,16 @@ start_link(Opts) ->
%%====================================================================
init([Opts, CallerPid]) ->
case init_state(Opts, CallerPid) of
- {ok, State} ->
+ {ok, State = #state{}} ->
{ok, State};
Error ->
{stop, Error}
end.
-handle_call(_Request, _From, State) ->
+handle_call(_Request, _From, State = #state{}) ->
{reply, ignore, State}.
-handle_cast(_Msg, State) ->
+handle_cast(_Msg, State = #state{}) ->
{noreply, State}.
handle_info({tcp, Socket, Data}, #state{callback=Callback,
@@ -146,7 +146,7 @@ handle_info({tcp_error, _ ,_}, #state{callback=Callback,
{stop, Error, State}
end;
-handle_info(_Info, State) ->
+handle_info(_Info, State = #state{}) ->
{noreply, State}.
terminate(_Reason, _State) ->
@@ -216,6 +216,8 @@ authenticate(Socket, Auth) ->
ok;
{ok, <<"+OK\r\n">>} ->
ok;
+ {ok, Other} ->
+ {error, {ok, Other}};
Error ->
Error
end;

0 comments on commit 84ebe67

Please sign in to comment.