anchor.diff:  -spec(terminate(Reason :: (normal | shutdown | {shutdown, term()} | term()),
       State :: #state{}) -> term()).
   
  -terminate(_Reason, #state{session = SO}) ->
  -    mqtt_session:cleanup(SO).
  +terminate(_Reason,S) ->
  +    cleanup(S).
   
   %%--------------------------------------------------------------------
   %% @private
  
positive.code:     Packet = mqtt_session:to_publish(CTRPacket,Retained,QoS,PacketId,false),
      send_to_client(Sender,Packet).
  
  cleanup(#state{session = SO, client_id = ClientId}) ->
      mqtt_reg_repo:unregister(ClientId),
      mqtt_session:cleanup(SO).
  
  maybe_persist(S) ->
      %% @todo: handle persistence
      S.
  
negative.code:     {noreply,S};
  
  handle_cast({force_close, _Reason}, S) ->
      %% cleanup(S),
      {stop, normal, S};
  
  handle_cast(_Request, State) ->
  