1 | Index: src/or/rendservice.c |
---|
2 | =================================================================== |
---|
3 | --- src/or/rendservice.c (revision 17386) |
---|
4 | +++ src/or/rendservice.c (working copy) |
---|
5 | @@ -291,9 +291,10 @@ |
---|
6 | config_line_t *line; |
---|
7 | rend_service_t *service = NULL; |
---|
8 | rend_service_port_config_t *portcfg; |
---|
9 | + smartlist_t *old_service_list = NULL; |
---|
10 | |
---|
11 | if (!validate_only) { |
---|
12 | - rend_service_free_all(); |
---|
13 | + old_service_list = rend_service_list; |
---|
14 | rend_service_list = smartlist_create(); |
---|
15 | } |
---|
16 | |
---|
17 | @@ -473,6 +474,25 @@ |
---|
18 | rend_add_service(service); |
---|
19 | } |
---|
20 | |
---|
21 | + if (old_service_list && !validate_only) { |
---|
22 | + strmap_t *old_service_by_dir = strmap_new(); |
---|
23 | + SMARTLIST_FOREACH(old_service_list, rend_service_t *, ptr, |
---|
24 | + strmap_set(old_service_by_dir, ptr->directory, ptr)); |
---|
25 | + SMARTLIST_FOREACH(rend_service_list, rend_service_t *, ptr, |
---|
26 | + { |
---|
27 | + rend_service_t *old = strmap_get(old_service_by_dir, ptr->directory); |
---|
28 | + if (old) { |
---|
29 | + smartlist_add_all(ptr->intro_nodes, old->intro_nodes); |
---|
30 | + smartlist_clear(old->intro_nodes); |
---|
31 | + } |
---|
32 | + }); |
---|
33 | + |
---|
34 | + strmap_free(old_service_by_dir, NULL); |
---|
35 | + SMARTLIST_FOREACH(old_service_list, rend_service_t *, ptr, |
---|
36 | + rend_service_free(ptr)); |
---|
37 | + smartlist_free(old_service_list); |
---|
38 | + } |
---|
39 | + |
---|
40 | return 0; |
---|
41 | } |
---|
42 | |
---|