From: Pekka Riikonen Date: Thu, 16 Jan 2003 17:43:58 +0000 (+0000) Subject: Check that fd is valid in generic task queues before calling X-Git-Tag: silc.client.0.9.11.2~3 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=9cc92312680c1cccf11c159214e88a415e8a5184;p=silc.git Check that fd is valid in generic task queues before calling the callback. --- diff --git a/lib/silcutil/silcschedule.c b/lib/silcutil/silcschedule.c index e0f658b0..ff47e294 100644 --- a/lib/silcutil/silcschedule.c +++ b/lib/silcutil/silcschedule.c @@ -399,7 +399,7 @@ static void silc_schedule_dispatch_nontimeout(SilcSchedule schedule) task = schedule->generic_queue->task; while(1) { - /* Validity of the task is checked always before and after + /* Validity of the task and fd is checked always before and after execution beacuse the task might have been unregistered in the callback function, ie. it is not valid anymore. */ @@ -414,7 +414,8 @@ static void silc_schedule_dispatch_nontimeout(SilcSchedule schedule) } /* Is the task ready for writing */ - if (task->valid && schedule->fd_list[i].revents & SILC_TASK_WRITE) { + if (task->valid && schedule->fd_list[i].revents & SILC_TASK_WRITE && + fd == schedule->fd_list[i].fd) { silc_mutex_unlock(schedule->generic_queue->lock); SILC_SCHEDULE_UNLOCK(schedule); task->callback(schedule, schedule->app_context,