D23537: extend state verification to open connection commands

Harald Sitter noreply at phabricator.kde.org
Wed Aug 28 16:21:29 BST 2019


sitter added a comment.


  I do wonder if maybe it would make sense to revise the verification system to be based off of a list of allowed/forbidden functions that may be called during a command.
  
  e.g. for open the requirements are actually more complicated than this diff establishes. It should be: CMD_OPEN must result in exactly 1 opened() call OR exactly 1 error() call AND must not ever call finished(). This is a less specific variant of what m_finalityCommand represents. Where m_finalityCommand simply marks a command as allowed/forbidden to call error and finished, a more dynamic system would allow us to tightly control different calls.
  
  Simply put: Any given command has 0:N functions it may or may not call. And currently we have no system to codify that.
  
  So maybe something like this would make sense:
  
    void validateCall(QString name)
    {
    q_assert(m_CurrentlyAllowedCalls.include?(name), "mustn't call this function");
    }
    
    void opened()
    {
    validateCall("opened");
    ...
    }
    
    void finished()
    {
    validateCall("finished");
    ...
    }

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D23537

To: sitter, dfaure
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190828/dc312ecb/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list