Commit f33556bc authored by Kai Vehmanen's avatar Kai Vehmanen

Add proper handling of unknown NUA events to nua_glib.

darcs-hash:20060914152052-7659e-e768ba7ec78e1d1d00a1193fcbc62c7181622151.gz
parent 9d7b2952
......@@ -1217,6 +1217,12 @@ sof_callback(nua_event_t event,
g_warning("%s: unknown event %d\n", self->priv->name, event);
tl_print(stderr, "", tags);
if (nua_glib_op_find_by_handle(self, nh) == NULL) {
/* note: unknown handle, not associated to any existing call,
* message, registration, etc, so it can be safely destroyed */
nua_handle_destroy(nh);
}
}
/* ====================================================================== */
......
......@@ -195,6 +195,20 @@ void nua_glib_op_destroy(NuaGlib *self, NuaGlibOp *op)
su_free(self->priv->home, op);
}
/**
* Finds an operation by nua handle.
*/
NuaGlibOp *nua_glib_op_find_by_handle(NuaGlib *self, nua_handle_t *handle)
{
NuaGlibOp *op;
for (op = self->priv->operations; op; op = op->op_next)
if (op->op_handle == handle)
break;
return op;
}
/**
* Finds a call/session operation (an operation that has non-zero
* op_callstate).
......@@ -210,6 +224,7 @@ NuaGlibOp *nua_glib_op_find_session(NuaGlib *self)
return op;
}
/**
* Checks whether 'op' is a valid handle or not.
*
......
......@@ -39,6 +39,7 @@ NuaGlibOp *nua_glib_op_create_with_handle(NuaGlib *self,
nua_handle_t *nh,
sip_from_t const *from);
void nua_glib_op_destroy(NuaGlib *self, NuaGlibOp *op);
NuaGlibOp *nua_glib_op_find_by_handle(NuaGlib *self, nua_handle_t *handle);
NuaGlibOp *nua_glib_op_find_session(NuaGlib *self);
NuaGlibOp *nua_glib_op_check(NuaGlib *self, NuaGlibOp *op);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment