if (silc_unlikely(silc_hash_table_find(schedule->fd_queue,
SILC_32_TO_PTR(fd),
NULL, (void **)&task))) {
- if (task->valid) {
- task = NULL;
+ if (task->valid)
goto out;
- }
/* Remove invalid task. We must have unique fd key to hash table. */
silc_schedule_task_remove(schedule, task);
task = NULL;
goto out;
}
- if (!schedule_ops.schedule_fd(schedule, schedule->internal,
+ if (!schedule_ops.schedule_fd(schedule, schedule->internal,
ftask, ftask->events)) {
silc_hash_table_del(schedule->fd_queue, SILC_32_TO_PTR(fd));
task = NULL;
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1998 - 2006 Pekka Riikonen
+ Copyright (C) 1998 - 2007 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
* The task will be initially set for SILC_TASK_READ events. Setting that
* event immediately after this call returns is not necessary.
*
+ * This returns the new task or NULL on error. If a task with `fd' has
+ * already been added this will return the existing task pointer.
+ *
***/
#define silc_schedule_task_add_fd(schedule, fd, callback, context) \
silc_schedule_task_add(schedule, fd, callback, context, 0, 0, SILC_TASK_FD)
*
* SYNOPSIS
*
- * SilcBool silc_schedule_set_listen_fd(SilcSchedule schedule,
+ * SilcBool silc_schedule_set_listen_fd(SilcSchedule schedule,
* SilcUInt32 fd,
* SilcTaskEvent mask,
* SilcBool send_events);