- clear_collectors(nf);
-
- svec_clone(&collectors, &nf_options->collectors);
- svec_sort_unique(&collectors);
-
- nf->fds = xmalloc(sizeof *nf->fds * collectors.n);
- for (i = 0; i < collectors.n; i++) {
- const char *name = collectors.names[i];
- char *tmpname = xstrdup(name);
- int fd = open_collector(tmpname);
- free(tmpname);
- if (fd >= 0) {
- nf->fds[nf->n_fds++] = fd;
- } else {
- VLOG_WARN("couldn't open connection to collector (%s), "
- "ignoring %s\n", strerror(-fd), name);
- if (!error) {
- error = -fd;
- }
- }
- }
-
- svec_destroy(&collectors);
+ collectors_destroy(nf->collectors);
+ collectors_create(&nf_options->collectors, 0, &nf->collectors);