+var replace_json = function(new_json_contents, mtime) {
+ var new_json = {
+ parsed: JSON.parse(new_json_contents),
+ plain: new_json_contents,
+ last_modified: mtime
+ };
+
+ // gzip the new version, and put it into place.
+ zlib.gzip(new_json_contents, function(err, buffer) {
+ if (err) throw err;
+
+ new_json.gzip = buffer;
+ json = new_json;
+
+ // Finally, wake up any sleeping clients.
+ possibly_wakeup_clients();
+ });
+}
+