Remove MDL when delete operation fails with INVALID_MDLID error

We can remove a data channel if error code Invalid MDLID is provided
in reply to a MD_DELETE_MDL_REQ. That error is provided only if the
MDL ID referenced is invalid. This shall be used when:
- A reserved or invalid value for MDL ID was used.
- The MDL ID referenced is not available (was never created, has
been deleted, or was otherwise lost),
- The MDL ID referenced in the Abort request is not the same value
that was used to initiate the PENDING state
This commit is contained in:
Santiago Carot-Nemesio 2010-10-13 18:51:11 +02:00 committed by Jose Antonio Santos Cadenas
parent d44b6e979b
commit 860f095113

View File

@ -1437,6 +1437,18 @@ static void restore_mdl(gpointer elem, gpointer data)
mdl->mcl->cb->mdl_closed(mdl, mdl->mcl->cb->user_data); mdl->mcl->cb->mdl_closed(mdl, mdl->mcl->cb->user_data);
} }
static void check_mdl_del_err(struct mcap_mdl *mdl, mcap_rsp *rsp)
{
if (rsp->rc != MCAP_ERROR_INVALID_MDL) {
restore_mdl(mdl, NULL);
return;
}
/* MDL does not exist in remote side, we can delete it */
mdl->mcl->mdls = g_slist_remove(mdl->mcl->mdls, mdl);
free_mdl(mdl);
}
static gboolean process_md_delete_mdl_rsp(struct mcap_mcl *mcl, mcap_rsp *rsp, static gboolean process_md_delete_mdl_rsp(struct mcap_mcl *mcl, mcap_rsp *rsp,
uint32_t len) uint32_t len)
{ {
@ -1458,7 +1470,7 @@ static gboolean process_md_delete_mdl_rsp(struct mcap_mcl *mcl, mcap_rsp *rsp,
if (gerr) { if (gerr) {
if (mdl) if (mdl)
restore_mdl(mdl, NULL); check_mdl_del_err(mdl, rsp);
else else
g_slist_foreach(mcl->mdls, restore_mdl, NULL); g_slist_foreach(mcl->mdls, restore_mdl, NULL);
deleted_cb(gerr, user_data); deleted_cb(gerr, user_data);