diff options
author | Raimo Niskanen <[email protected]> | 2016-07-25 15:41:19 +0200 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2016-08-02 09:37:56 +0200 |
commit | adf04d0c3dbb20e539892a1262078eb5a6538c97 (patch) | |
tree | 96152dc2d56dc6073c1ef8497ebd22c1aa534832 | |
parent | 401dbd2334cf8f063c9a697eafcd0694e3bbe2fe (diff) | |
download | otp-adf04d0c3dbb20e539892a1262078eb5a6538c97.tar.gz otp-adf04d0c3dbb20e539892a1262078eb5a6538c97.tar.bz2 otp-adf04d0c3dbb20e539892a1262078eb5a6538c97.zip |
Rewrite SSH for gen_statem M:callback_mode/0
-rw-r--r-- | lib/ssh/src/ssh_connection_handler.erl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index f9f4c82351..dcb6ff9343 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -60,7 +60,8 @@ ]). %%% Behaviour callbacks --export([handle_event/4, terminate/3, format_status/2, code_change/4]). +-export([callback_mode/0, handle_event/4, terminate/3, + format_status/2, code_change/4]). %%% Exports not intended to be used :). They are used for spawning and tests -export([init_connection_handler/3, % proc_lib:spawn needs this @@ -374,14 +375,12 @@ init_connection_handler(Role, Socket, Opts) -> S -> gen_statem:enter_loop(?MODULE, [], %%[{debug,[trace,log,statistics,debug]} || Role==server], - handle_event_function, {hello,Role}, S) catch _:Error -> gen_statem:enter_loop(?MODULE, [], - handle_event_function, {init_error,Error}, S0) end. @@ -504,6 +503,9 @@ init_ssh_record(Role, Socket, Opts) -> %%% ######## Error in the initialisation #### +callback_mode() -> + handle_event_function. + handle_event(_, _Event, {init_error,Error}, _) -> case Error of {badmatch,{error,enotconn}} -> @@ -1401,12 +1403,12 @@ fmt_stat_rec(FieldNames, Rec, Exclude) -> state_name(), #data{}, term() - ) -> {gen_statem:callback_mode(), state_name(), #data{}}. + ) -> {ok, state_name(), #data{}}. %% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . code_change(_OldVsn, StateName, State, _Extra) -> - {handle_event_function, StateName, State}. + {ok, StateName, State}. %%==================================================================== |