unsigned buddy_given;
const struct lls_opt_result *r_b;
- ctx = fn->private_data = para_calloc(sizeof(*ctx));
+ ctx = fn->private_data = zalloc(sizeof(*ctx));
init_list_head(&ctx->buddies);
/* create socket to listen for incoming packets */
close(fd);
goto fail;
}
- buddy = para_malloc(sizeof(*buddy));
+ buddy = alloc(sizeof(*buddy));
buddy->fd = fd;
buddy->sbi = sbi + i;
buddy->ping_received = false;
r_b = FILTER_CMD_OPT_RESULT(SYNC, BUDDY, lpr);
n = lls_opt_given(r_b);
- sbi = para_malloc(n * sizeof(*sbi));
+ sbi = arr_alloc(n, sizeof(*sbi));
PARA_INFO_LOG("initializing buddy info array of length %u\n", n);
for (i = 0; i < n; i++) {
const char *url = lls_string_val(i, r_b);
size_t len = strlen(url);
- char *host = para_malloc(len + 1);
+ char *host = alloc(len + 1);
int port;
struct addrinfo *ai;
tv_add(now, &to, &ctx->timeout);
}
-static void sync_pre_select(struct sched *s, void *context)
+static void sync_pre_monitor(struct sched *s, void *context)
{
int ret;
struct filter_node *fn = context;
ret = btr_node_status(fn->btrn, 0, BTR_NT_INTERNAL);
if (ret < 0)
return sched_min_delay(s);
- para_fd_set(ctx->listen_fd, &s->rfds, &s->max_fileno);
+ sched_monitor_readfd(ctx->listen_fd, s);
if (ret == 0)
return;
if (ctx->timeout.tv_sec == 0) { /* must ping buddies */
return NULL;
}
-static int sync_post_select(__a_unused struct sched *s, void *context)
+static int sync_post_monitor(__a_unused struct sched *s, void *context)
{
int ret;
struct filter_node *fn = context;
}
ctx->ping_sent = true;
}
- if (FD_ISSET(ctx->listen_fd, &s->rfds)) {
+ if (sched_read_ok(ctx->listen_fd, s)) {
char c;
for (;;) {
struct sockaddr src_addr;
const struct filter lsg_filter_cmd_com_sync_user_data = {
.setup = sync_setup,
.open = sync_open,
- .pre_select = sync_pre_select,
- .post_select = sync_post_select,
+ .pre_monitor = sync_pre_monitor,
+ .post_monitor = sync_post_monitor,
.close = sync_close,
.teardown = sync_teardown
};