void
-extract_handles (struct GNUNET_SCHEDULER_Task *t,
- const struct GNUNET_NETWORK_FDSet *fdset,
+extract_handles (const struct GNUNET_NETWORK_FDSet *fdset,
const struct GNUNET_NETWORK_Handle ***ntarget,
unsigned int *extracted_nhandles,
const struct GNUNET_DISK_FileHandle ***ftarget,
unsigned int nhandles_len;
unsigned int fhandles_len;
- (void) t;
nhandles = NULL;
fhandles = NULL;
nhandles_len = 0;
const struct GNUNET_DISK_FileHandle **write_fhandles;
unsigned int read_nhandles_len, write_nhandles_len,
read_fhandles_len, write_fhandles_len;
- int no_fdsets = (NULL == rs) && (NULL == ws);
- int no_socket_descriptors =
- ((NULL != rs) && (0 == rs->nsds)) && ((NULL != ws) && (0 == ws->nsds));
-
- if (no_fdsets || no_socket_descriptors)
+
+ int no_rs = (NULL == rs);
+ int no_ws = (NULL == ws);
+ int empty_rs = (NULL != rs) && (0 == rs->nsds);
+ int empty_ws = (NULL != ws) && (0 == ws->nsds);
+ int no_socket_descriptors = (no_rs && no_ws) ||
+ (empty_rs && empty_ws) ||
+ (no_rs && empty_ws) ||
+ (no_ws && empty_rs);
+ if (no_socket_descriptors)
return GNUNET_SCHEDULER_add_delayed_with_priority (delay,
prio,
task,
GNUNET_assert (NULL != scheduler_driver);
GNUNET_assert (NULL != active_task);
GNUNET_assert (NULL != task);
- t = GNUNET_new (struct GNUNET_SCHEDULER_Task);
- t->callback = task;
- t->callback_cls = task_cls;
- t->read_fd = -1;
- t->write_fd = -1;
- t->own_handles = GNUNET_YES;
read_nhandles = NULL;
write_nhandles = NULL;
read_fhandles = NULL;
write_fhandles_len = 0;
if (NULL != rs)
{
- extract_handles (t,
- rs,
+ extract_handles (rs,
&read_nhandles,
&read_nhandles_len,
&read_fhandles,
}
if (NULL != ws)
{
- extract_handles (t,
- ws,
+ extract_handles (ws,
&write_nhandles,
&write_nhandles_len,
&write_fhandles,
&write_fhandles_len);
}
+ GNUNET_assert ((read_nhandles > 0) ||
+ (read_fhandles > 0) ||
+ (write_nhandles > 0) ||
+ (write_fhandles > 0));
+ t = GNUNET_new (struct GNUNET_SCHEDULER_Task);
init_fd_info (t,
read_nhandles,
read_nhandles_len,
read_fhandles_len,
write_fhandles,
write_fhandles_len);
+ t->callback = task;
+ t->callback_cls = task_cls;
+ t->own_handles = GNUNET_YES;
/* free the arrays of pointers to network / file handles, the actual
* handles will be freed in destroy_task */
GNUNET_array_grow (read_nhandles, read_nhandles_len, 0);
context = cls;
ret = GNUNET_SYSERR;
pos = context->scheduled_head;
- if (0 == task->fds_len)
- return GNUNET_OK;
while (NULL != pos)
{
struct Scheduled *next = pos->next;