Skip to content
Browse files

TS-1566: dynamic update for string vars does not work

  • Loading branch information...
1 parent ec01961 commit da19639e0b0338b78b69e11e0fd4e3a0c5220b6b Aidan McGurn committed with jpeach Mar 22, 2013
Showing with 12 additions and 9 deletions.
  1. +3 −0 CHANGES
  2. +9 −9 lib/records/RecCore.cc
View
3 CHANGES
@@ -2,6 +2,9 @@
Changes with Apache Traffic Server 3.3.2
+ *) [TS-1566] dynamic update for string vars does not work
+ Author: Aidan McGurn <aidan.mcgurn@openwave.com>
+
*) [TS-1708] Using tr-pass port option causes requests with large headers to hang
*) [TS-1734] Remove dead code that invokes missing vmap_config tool
View
18 lib/records/RecCore.cc
@@ -143,30 +143,30 @@ link_byte(const char *name, RecDataT data_type, RecData data, void *cookie)
}
// mimic Config.cc::config_string_alloc_cb
+// cookie e.g. is the DEFAULT_xxx_str value which this functiion keeps up to date with
+// the latest default applied during a config update from records.config
static int
link_string_alloc(const char *name, RecDataT data_type, RecData data, void *cookie)
{
REC_NOWARN_UNUSED(name);
REC_NOWARN_UNUSED(data_type);
- RecString _ss = (RecString) cookie;
- RecString _new_value = 0;
+ RecString _ss = data.rec_string;
+ RecString _new_value = NULL;
- int len = -1;
if (_ss) {
- len = strlen(_ss);
- _new_value = (RecString)ats_malloc(len + 1);
- memcpy(_new_value, _ss, len + 1);
+ _new_value = ats_strdup(_ss);
}
- RecString _temp2 = data.rec_string;
- data.rec_string = _new_value;
+ // set new string for DEFAULT_xxx_str tp point to
+ RecString _temp2 = *((RecString *)cookie);
+ *((RecString *)cookie) = _new_value;
+ // free previous string DEFAULT_xxx_str points to
ats_free(_temp2);
return REC_ERR_OKAY;
}
-
//-------------------------------------------------------------------------
// RecCoreInit
//-------------------------------------------------------------------------

0 comments on commit da19639

Please sign in to comment.
Something went wrong with that request. Please try again.