restore RemoveCallback3 as RemoveCallbackUsr to get (un)interest working again
This commit is contained in:
30
callback.c
30
callback.c
@ -271,6 +271,36 @@ int RemoveCallback2(pICallBack self, void *pUserData)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Remove callback in context -
|
||||
* if the callback function matches and the user function returns zero
|
||||
*/
|
||||
int RemoveCallbackUsr(pICallBack self, SICSCallBack pFunc, int (*userfunc)(const void* pContext, const void* pUserData), void *pCtx)
|
||||
{
|
||||
pCallBackItem pItem;
|
||||
|
||||
if (!CheckPointer(self))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pItem = self->head;
|
||||
while (pItem != NULL) {
|
||||
if (pItem->pFunc == pFunc) {
|
||||
if(userfunc(pCtx, pItem->pUserData) == 0) {
|
||||
if (debug) {
|
||||
printf("Killing callback at %p\n", self);
|
||||
}
|
||||
pItem->killFlag = 1;
|
||||
}
|
||||
}
|
||||
pItem = pItem->next;
|
||||
}
|
||||
cleanCallbackList(self);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int RemoveCallbackCon(pICallBack self, SConnection * con)
|
||||
{
|
||||
|
Reference in New Issue
Block a user