|
|
@ -66,7 +66,6 @@ struct io_context {
|
|
|
|
int needshrink;
|
|
|
|
int needshrink;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct io_context *io_context_create(void)
|
|
|
|
struct io_context *io_context_create(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Create an I/O context */
|
|
|
|
/* Create an I/O context */
|
|
|
@ -88,10 +87,11 @@ struct io_context *io_context_create(void)
|
|
|
|
free(tmp->fds);
|
|
|
|
free(tmp->fds);
|
|
|
|
free(tmp);
|
|
|
|
free(tmp);
|
|
|
|
tmp = NULL;
|
|
|
|
tmp = NULL;
|
|
|
|
} else
|
|
|
|
} else {
|
|
|
|
memset(tmp->ior, 0, (GROW_SHRINK_SIZE / 2) * sizeof(struct io_rec));
|
|
|
|
memset(tmp->ior, 0, (GROW_SHRINK_SIZE / 2) * sizeof(struct io_rec));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return tmp;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +130,6 @@ static int io_grow(struct io_context *ioc)
|
|
|
|
ioc->maxfdcnt -= GROW_SHRINK_SIZE;
|
|
|
|
ioc->maxfdcnt -= GROW_SHRINK_SIZE;
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Out of memory. We return to the old size, and return a failure
|
|
|
|
* Out of memory. We return to the old size, and return a failure
|
|
|
@ -190,7 +189,8 @@ int *ast_io_change(struct io_context *ioc, int *id, int fd, ast_io_cb callback,
|
|
|
|
if (data)
|
|
|
|
if (data)
|
|
|
|
ioc->ior[*id].data = data;
|
|
|
|
ioc->ior[*id].data = data;
|
|
|
|
return id;
|
|
|
|
return id;
|
|
|
|
} else return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int io_shrink(struct io_context *ioc)
|
|
|
|
static int io_shrink(struct io_context *ioc)
|
|
|
|