Bug 1008812 - change dom.mms.retrievalRetryIntervals to shorten the mms wait time. r=vyang

This commit is contained in:
wei.gao@spreadtrum.com 2014-05-28 10:33:22 -04:00
parent 724b56f8f7
commit 7af34a3085
2 changed files with 18 additions and 7 deletions

View File

@ -98,8 +98,20 @@ const DELIVERY_STATUS_NOT_APPLICABLE = "not-applicable";
const PREF_SEND_RETRY_COUNT =
Services.prefs.getIntPref("dom.mms.sendRetryCount");
const PREF_SEND_RETRY_INTERVAL =
Services.prefs.getIntPref("dom.mms.sendRetryInterval");
const PREF_SEND_RETRY_INTERVAL = (function () {
let intervals =
Services.prefs.getCharPref("dom.mms.sendRetryInterval").split(",");
for (let i = 0; i < PREF_SEND_RETRY_COUNT; ++i) {
intervals[i] = parseInt(intervals[i], 10);
// If one of the intervals isn't valid (e.g., 0 or NaN),
// assign a 1-minute interval to it as a default.
if (!intervals[i]) {
intervals[i] = 60000;
}
}
intervals.length = PREF_SEND_RETRY_COUNT;
return intervals;
})();
const PREF_RETRIEVAL_RETRY_COUNT =
Services.prefs.getIntPref("dom.mms.retrievalRetryCount");
@ -1266,15 +1278,13 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
MMS.MMS_PDU_ERROR_PERMANENT_FAILURE == mmsStatus) &&
this.retryCount < PREF_SEND_RETRY_COUNT) {
if (DEBUG) {
debug("Fail to send. Will retry after: " + PREF_SEND_RETRY_INTERVAL);
debug("Fail to send. Will retry after: " + PREF_SEND_RETRY_INTERVAL[this.retryCount]);
}
if (this.timer == null) {
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
}
this.retryCount++;
// the input stream may be read in the previous failure request so
// we have to re-compose it.
if (this.istreamSize == null ||
@ -1283,8 +1293,9 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
}
this.timer.initWithCallback(this.send.bind(this, retryCallback),
PREF_SEND_RETRY_INTERVAL,
PREF_SEND_RETRY_INTERVAL[this.retryCount],
Ci.nsITimer.TYPE_ONE_SHOT);
this.retryCount++;
return;
}

View File

@ -4052,7 +4052,7 @@ pref("dom.mms.requestStatusReport", true);
pref("dom.mms.retrieval_mode", "manual");
pref("dom.mms.sendRetryCount", 3);
pref("dom.mms.sendRetryInterval", 300000);
pref("dom.mms.sendRetryInterval", "10000,60000,180000");
pref("dom.mms.retrievalRetryCount", 4);
pref("dom.mms.retrievalRetryIntervals", "60000,300000,600000,1800000");