Prechádzať zdrojové kódy

Change interface to config_trial_assign even more; have it use get_options() instead

svn:r2754
Nick Mathewson 19 rokov pred
rodič
commit
b960574556
3 zmenil súbory, kde vykonal 6 pridanie a 6 odobranie
  1. 4 4
      src/or/config.c
  2. 1 1
      src/or/control.c
  3. 1 1
      src/or/or.h

+ 4 - 4
src/or/config.c

@@ -674,17 +674,17 @@ config_assign(or_options_t *options, struct config_line_t *list, int reset)
   return 0;
 }
 
-/** Try assigning <b>list</b> to <b>options</b>. You do this by duping
+/** Try assigning <b>list</b> to the global options. You do this by duping
  * options, assigning list to the new one, then validating it. If it's
  * ok, then through out the old one and stick with the new one. Else,
  * revert to old and return failure.  Return 0 on success, -1 on bad
  * keys, -2 on bad values, -3 on bad transition.
  */
 int
-config_trial_assign(or_options_t *options, struct config_line_t *list, int reset)
+config_trial_assign(struct config_line_t *list, int reset)
 {
   int r;
-  or_options_t *trial_options = options_dup(options);
+  or_options_t *trial_options = options_dup(get_options());
 
   if ((r=config_assign(trial_options, list, reset)) < 0) {
     options_free(trial_options);
@@ -696,7 +696,7 @@ config_trial_assign(or_options_t *options, struct config_line_t *list, int reset
     return -2;
   }
 
-  if (options_transition_allowed(options, trial_options) < 0) {
+  if (options_transition_allowed(get_options(), trial_options) < 0) {
     options_free(trial_options);
     return -3;
   }

+ 1 - 1
src/or/control.c

@@ -209,7 +209,7 @@ handle_control_setconf(connection_t *conn, uint16_t len, char *body)
     return 0;
   }
 
-  if ((r=config_trial_assign(get_options(), lines, 1)) < 0) {
+  if ((r=config_trial_assign(lines, 1)) < 0) {
     log_fn(LOG_WARN,"Controller gave us config lines that didn't validate.");
     if (r==-1) {
       send_control_error(conn, ERR_UNRECOGNIZED_CONFIG_KEY,

+ 1 - 1
src/or/or.h

@@ -1097,7 +1097,7 @@ int options_act(void);
 
 int config_get_lines(char *string, struct config_line_t **result);
 void config_free_lines(struct config_line_t *front);
-int config_trial_assign(or_options_t *options, struct config_line_t *list, int reset);
+int config_trial_assign(struct config_line_t *list, int reset);
 int resolve_my_address(const char *address, uint32_t *addr);
 void options_init(or_options_t *options);
 int init_from_config(int argc, char **argv);