From 2de46ba543db098fa9cd938224a8d946304cb634 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 20 Feb 1992 18:38:21 +0000 Subject: [PATCH] use lstFind to verify channel (not hand written loop) --- src/rsrv/camessage.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/rsrv/camessage.c b/src/rsrv/camessage.c index c1f3feeb4..9f0921816 100644 --- a/src/rsrv/camessage.c +++ b/src/rsrv/camessage.c @@ -39,6 +39,7 @@ * and the server. * .06 joh 110491 lock added for IOC_CLAIM_CIU command * .07 joh 021292 Better diagnostics + * .08 joh 021492 use lstFind() to verify chanel in clear_channel() */ #include @@ -347,10 +348,8 @@ struct client *client; { FAST struct extmsg *reply; FAST struct event_ext *pevext; - FAST int status; struct channel_in_use *pciu; - struct channel_in_use *ptmpciu; - LIST *peventq; + FAST int status; /* * @@ -358,31 +357,25 @@ struct client *client; * */ pciu = (struct channel_in_use *) mp->m_pciu; - ptmpciu = (struct channel_in_use *) client->addrq.node.next; - while (ptmpciu){ - if(ptmpciu == pciu){ - break; - } - ptmpciu = (struct channel_in_use *) ptmpciu->node.next; - } - if(!ptmpciu){ + status = lstFind( + &client->addrq, + mp->m_pciu); + if(status < 0){ logMsg("CAS: Attempt to delete nonexistent channel ignored\n"); return; } - peventq = &pciu->eventq; - for (pevext = (struct event_ext *) peventq->node.next; - pevext; - pevext = (struct event_ext *) pevext->node.next) { - status = db_cancel_event(pevext + 1); - if (status == ERROR) - taskSuspend(0); - lstDelete(peventq, pevext); + while (pevext = (struct event_ext *) lstGet(&pciu->eventq)) { + status = db_cancel_event(pevext + 1); + if (status == ERROR){ + taskSuspend(0); + } FASTLOCK(&rsrv_free_eventq_lck); lstAdd(&rsrv_free_eventq, pevext); FASTUNLOCK(&rsrv_free_eventq_lck); - } + } + /* * send delete confirmed message @@ -424,10 +417,9 @@ event_cancel_reply(mp, client) { FAST struct extmsg *reply; FAST struct event_ext *pevext; - FAST int status; LIST *peventq = &((struct channel_in_use *) mp->m_pciu)->eventq; - + FAST int status; for (pevext = (struct event_ext *) peventq->node.next; pevext;