anchor.diff:      megaco_udp:close(Handle),
       {ok, State#{handle => undefined, control_pid => undefined}}.
   
  -client_stop_transport(#client{transport_ref = Ref} = State) 
  -  when (Ref =/= undefined) ->
  -    megaco_udp:stop_transport(Ref),
  -    {ok, State#client{transport_ref = undefined}};
   client_stop_transport(#{transport_ref := Ref} = State) 
     when (Ref =/= undefined) ->
       megaco_udp:stop_transport(Ref),
       {ok, State#{transport_ref => undefined}}.
   
       
  -%% -------- Command handler ---------
  +%% -------- Command handler interface ---------
   
   start_command_handler(Node, Commands, State, ShortName) ->
  -    Fun = fun() ->
  -		  put(sname, ShortName), 
  -		  process_flag(trap_exit, true),
  -		  Result = (catch command_handler(Commands, State)),
  -		  p("command handler terminated with: "
  -		    "~n   Result: ~p", [Result]),
  -		  exit(Result)
  -	  end,
  -    erlang:spawn_link(Node, Fun).
  -		  
  -command_handler([], State) ->
  -    p("command_handler -> entry when done with"
  -      "~n   State: ~p", [State]),
  -    {ok, State};
  -command_handler([#command{id   = Id,
  -			  desc = Desc,
  -			  cmd  = Cmd}|Commands], State) ->
  -    p("command_handler -> entry with"
  -      "~n   Id:   ~p"
  -      "~n   Desc: ~p", [Id, Desc]),
  -    case (catch Cmd(State)) of
  -	{ok, NewState} ->
  -	    p("command_handler -> cmd ~w ok", [Id]),
  -	    command_handler(Commands, NewState);
  -	{skip, _} = SKIP ->
  -	    p("command_handler -> cmd ~w skip", [Id]),
  -	    SKIP;
  -	{error, Reason} ->
  -	    p("command_handler -> cmd ~w error: "
  -	      "~n   Reason: ~p", [Id, Reason]),
  -	    {error, {cmd_error, Reason}};
  -	{'EXIT', Reason} ->
  -	    p("command_handler -> cmv ~w exit: "
  -	      "~n   Reason: ~p", [Id, Reason]),
  -	    {error, {cmd_exit, Reason}};
  -	Error ->
  -	    p("command_handler -> cmd ~w failure: "
  -	      "~n   Error: ~p", [Id, Error]),
  -	    {error, {cmd_failure, Error}}
  -    end.
  +    ?CH:start(Node, Commands, State, ShortName).
   
   
   await_command_handler_completion(Pids, Timeout) ->
  -    await_command_handler_completion(Pids, [], [], Timeout).
  -%% await_command_handler_completion(Pids, Timeout) ->
  -%%     ?CH:await_completion(Pids, [], [], Timeout).
  -
  -await_command_handler_completion([], [], _Good, _Timeout) ->
  -    p("await_command_handler_completion -> entry when done"),
  -    ok;
  -await_command_handler_completion([], Bad, Good, _Timeout) ->
  -    p("await_command_handler_completion -> entry when done with bad result: "
  -      "~n   Bad:  ~p"
  -      "~n   Good: ~p", [Bad, Good]),
  -    {error, Bad, Good};
  -await_command_handler_completion(Pids, Bad, Good, Timeout) ->
  -    p("await_command_handler_completion -> entry when waiting for"
  -      "~n   Pids:    ~p"
  -      "~n   Bad:     ~p"
  -      "~n   Good:    ~p"
  -      "~n   Timeout: ~p", [Pids, Bad, Good, Timeout]), 
  -    Begin = ms(), 
  -    receive 
  -	{'EXIT', Pid, {ok, FinalState}} ->
  -	    p("await_command_handler_completion -> "
  -	      "received ok EXIT signal from ~p", [Pid]), 
  -	    case lists:delete(Pid, Pids) of
  -		Pids ->
  -		    await_command_handler_completion(Pids, Bad, Good, 
  -						     Timeout - (ms() - Begin));
  -		Pids2 ->
  -		    p("await_command_handler_completion -> ~p done", [Pid]), 
  -		    await_command_handler_completion(Pids2, 
  -						     Bad, 
  -						     [{Pid, FinalState}|Good],
  -						     Timeout - (ms() - Begin))
  -	    end;
  -
  -	{'EXIT', Pid, {error, Reason}} ->
  -	    p("await_command_handler_completion -> "
  -	      "received error EXIT signal from ~p", [Pid]), 
  -	    case lists:delete(Pid, Pids) of
  -		Pids ->
  -		    await_command_handler_completion(Pids, Bad, Good, 
  -						     Timeout - (ms() - Begin));
  -		Pids2 ->
  -		    p("await_command_handler_completion -> ~p done with"
  -		      "~n   ~p", [Pid, Reason]), 
  -		    await_command_handler_completion(Pids2, 
  -						     [{Pid, Reason}|Bad], 
  -						     Good, 
  -						     Timeout - (ms() - Begin))
  -	    end;
  -
  -	{'EXIT', Pid, {skip, Reason}} ->
  -	    p("await_command_handler_completion -> "
  -	      "received skip EXIT signal from ~p with"
  -	      "~p", [Pid, Reason]), 
  -	    ?SKIP(Reason)
  -
  -    after Timeout ->
  -	    p("await_command_handler_completion -> timeout"), 
  -	    exit({timeout, Pids})
  -    end.
  -
  +    ?CH:await_completion(Pids, Timeout).
   
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
positive.code: 	    {error, timeout}
      end.
      
  client_notify_blocked(#client{parent = Parent} = State) ->
      Parent ! {blocked, self()},
      {ok, State};
  client_notify_blocked(#{parent := Parent} = State) ->
      Parent ! {blocked, self()},
      {ok, State}.
  
  client_await_nothing(State, Timeout) 
    when is_record(State, client) ->
      receive 
  	Any ->
  	    p("received unexpected event: ~p", [Any]),
  	    {error, {unexpected_event, Any}}
      after Timeout ->
  	    {ok, State}
      end;
  client_await_nothing(State, Timeout) 
    when is_map(State) ->
      receive 
  
negative.code: 	      [?FTS(), self() | A]).
  
  
  %% ms() ->
  %%     erlang:monotonic_time(milli_seconds).
      
  
  