anchor.diff:       state_enter].
   
   
  -handle_event(_, _Event, {init_error,Error}=StateName, D) ->
  -    case Error of
  -        enotconn ->
  -           %% Handles the abnormal sequence:
  -           %%    SYN->
  -           %%            <-SYNACK
  -           %%    ACK->
  -           %%    RST->
  -            ?call_disconnectfun_and_log_cond("Protocol Error",
  -                                             "TCP connenction to server was prematurely closed by the client",
  -                                             StateName, D),
  -            {stop, {shutdown,"TCP connenction to server was prematurely closed by the client"}};
  -
  -        OtherError ->
  -            {stop, {shutdown,{init,OtherError}}}
  -    end;
  -
   %%% ######## {hello, client|server} ####
   %% The very first event that is sent when the we are set as controlling process of Socket
  -handle_event(_, socket_control, {hello,_}=StateName, #data{ssh_params = Ssh0} = D) ->
  +handle_event(cast, socket_control, {hello,_}=StateName, #data{ssh_params = Ssh0} = D) ->
       VsnMsg = ssh_transport:hello_version_msg(string_version(Ssh0)),
       send_bytes(VsnMsg, D),
       case inet:getopts(Socket=D#data.socket, [recbuf]) of
  
positive.code: %%% ######## {userauth, client|server} ####
  
  %%---- userauth request to server
  handle_event(_, 
  	     Msg = #ssh_msg_userauth_request{service = ServiceName, method = Method},
  	     StateName = {userauth,server},
  	     D0 = #data{ssh_params=Ssh0}) ->
  
negative.code:     D = send_msg(MsgReq, D0#data{ssh_params = Ssh}),
      {next_state, {ext_info,client,init}, D};
  
  handle_event(internal, #ssh_msg_newkeys{} = Msg, {new_keys,server,init}, D) ->
      {ok, Ssh} = ssh_transport:handle_new_keys(Msg, D#data.ssh_params),
      %% {ok, ExtInfo, Ssh} = ssh_transport:ext_info_message(Ssh1),
      %% send_bytes(ExtInfo, D),
      {next_state, {ext_info,server,init}, D#data{ssh_params=Ssh}};
  
  %% Subsequent key exchange rounds (renegotiation):
  handle_event(internal, #ssh_msg_newkeys{} = Msg, {new_keys,Role,renegotiate}, D) ->
      {ok, Ssh} = ssh_transport:handle_new_keys(Msg, D#data.ssh_params),
      %% {ok, ExtInfo, Ssh} = ssh_transport:ext_info_message(Ssh1),
      %% send_bytes(ExtInfo, D),
  