-static int init_writer_hashmap(RemoteServer *s) {
- static const struct {
- hash_func_t hash_func;
- compare_func_t compare_func;
- } functions[] = {
- [JOURNAL_WRITE_SPLIT_NONE] = {trivial_hash_func,
- trivial_compare_func},
- [JOURNAL_WRITE_SPLIT_HOST] = {string_hash_func,
- string_compare_func},
- };
-
- assert(arg_split_mode >= 0 && arg_split_mode < (int) ELEMENTSOF(functions));
-
- s->writers = hashmap_new(functions[arg_split_mode].hash_func,
- functions[arg_split_mode].compare_func);
- if (!s->writers)
- return log_oom();
-
- return 0;
-}
-
-static int get_writer(RemoteServer *s, const char *host, sd_id128_t *machine,
- Writer **writer) {
- const void *key;
- Writer *w;
- int r;
-
- switch(arg_split_mode) {
- case JOURNAL_WRITE_SPLIT_NONE:
- key = "one and only";
- break;
-
- case JOURNAL_WRITE_SPLIT_HOST:
- assert(host);
- key = host;
- break;
-
- default:
- assert_not_reached("what split mode?");
- }
-
- w = hashmap_get(s->writers, key);
- if (!w) {
- w = new0(Writer, 1);
- if (!w)
- return -ENOMEM;
-
- r = writer_init(w);
- if (r < 0) {
- free(w);
- return r;
- }
-
- r = hashmap_put(s->writers, key, w);
- if (r < 0) {
- writer_close(w);
- free(w);
- return r;
- }
-
- r = open_output(w, host);
- if (r < 0)
- return r;
- }
-
- *writer = w;
- return 0;
-}
-
-/**********************************************************************
- **********************************************************************
- **********************************************************************/
-
-static RemoteSource *request_meta(void **connection_cls, int fd, char *hostname) {