console.log("requesting counters...");
- var query = "?op=rpc&subop=getAllCounters";
+ var query = "?op=rpc&subop=getAllCounters&seq=" + next_seq();
if (tagsAreDisplayed()) {
query = query + "&omode=tl";
function handle_rpc_request($link) {
$subop = $_REQUEST["subop"];
+ $seq = (int) $_REQUEST["seq"];
if ($subop == "setprofile") {
$id = db_escape_string($_REQUEST["id"]);
print "<rpc-reply>";
+ if ($seq)
+ print "<seq>$seq</seq>";
+
if ($last_article_id != getLastArticleId($link)) {
print "<counters><![CDATA[";
$omode = $_REQUEST["omode"];
var _force_scheduled_update = false;
var last_scheduled_update = false;
+var _rpc_seq = 0;
+
+function next_seq() {
+ _rpc_seq += 1;
+ return _rpc_seq;
+}
+
+function get_seq() {
+ return _rpc_seq;
+}
+
function activeFeedIsCat() {
return _active_feed_is_cat;
}
window.clearTimeout(counter_timeout_id);
- var query_str = "?op=rpc&subop=getAllCounters";
+ var query_str = "?op=rpc&subop=getAllCounters&seq=" + next_seq();
var omode;
if (!transport_error_check(transport)) return false;
+ var seq = transport.responseXML.getElementsByTagName("seq")[0];
+
+ if (seq) {
+ seq = seq.firstChild.nodeValue;
+
+ if (get_seq() != seq) {
+ //console.log("[handle_rpc_reply] sequence mismatch: " + seq);
+ return true;
+ }
+ }
+
var message = transport.responseXML.getElementsByTagName("message")[0];
if (message) {