It is expected that tlm_reply() and tlm_replyQuery() return TRDP_NO_SESSION_ERR when the session of the given session id does not exist. Currently, it does not return that but instead returns TRDP_NOLIST_ERR .
Analysis / Solution Proposal:
trdp_mdReply() returns TRDP_NOLIST_ERR if a corresponding MD element (with expected Session Id and State) is not found in appHandle->pMDRcvQueue which then goes to the user level as a return error from tlm_reply() or tlm_replyQuery().
It makes sense to return TRDP_NOSESSION_ERR in this case from trdp_mdLookupElement() itself, as TRDP_NOLIST_ERR has a different meaning that a listener is not added.
Implementation added to trunk
error name changed (tested by inspection)