You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/03/22 18:30:56 UTC

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

Updated Branches:
  refs/heads/master ec019615f -> da19639e0


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


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/da19639e
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/da19639e
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/da19639e

Branch: refs/heads/master
Commit: da19639e0b0338b78b69e11e0fd4e3a0c5220b6b
Parents: ec01961
Author: Aidan McGurn <ai...@openwave.com>
Authored: Fri Mar 22 10:27:43 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Mar 22 10:29:06 2013 -0700

----------------------------------------------------------------------
 CHANGES                |    3 +++
 lib/records/RecCore.cc |   18 +++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/da19639e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 61e5938..4212088 100644
--- a/CHANGES
+++ b/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 <ai...@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

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/da19639e/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index 4888fbb..be3a2fd 100644
--- a/lib/records/RecCore.cc
+++ b/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
 //-------------------------------------------------------------------------