Bug 1174998 - Part 3: Read data call's MTU from network/apn settings. r=echen

This commit is contained in:
Jessica Jong 2015-09-23 15:35:32 +08:00
parent 9b8f929f77
commit 503c79eb9a
5 changed files with 31 additions and 5 deletions

View File

@ -72,7 +72,8 @@ DataCall.prototype = {
addreses: null,
dnses: null,
gateways: null,
pcscf: null
pcscf: null,
mtu: -1
};
function DataCallInterfaceService() {

View File

@ -961,7 +961,8 @@ function DataCall(aClientId, aApnSetting, aDataCallHandler) {
addresses: [],
dnses: [],
gateways: [],
pcscf: []
pcscf: [],
mtu: null
};
this.state = NETWORK_STATE_UNKNOWN;
this.requestedNetworkIfaces = [];
@ -1027,6 +1028,10 @@ DataCall.prototype = {
}
}
if (aCurrentDataCall.mtu != aUpdatedDataCall.mtu) {
return "changed";
}
return "identical";
},
@ -1093,6 +1098,7 @@ DataCall.prototype = {
this.linkInfo.gateways = aDataCall.gateways ? aDataCall.gateways.split(" ") : [];
this.linkInfo.dnses = aDataCall.dnses ? aDataCall.dnses.split(" ") : [];
this.linkInfo.pcscf = aDataCall.pcscf ? aDataCall.pcscf.split(" ") : [];
this.linkInfo.mtu = aDataCall.mtu > 0 ? aDataCall.mtu : 0;
this.state = this._getGeckoDataCallState(aDataCall);
// Notify DataCallHandler about data call connected.
@ -1146,7 +1152,8 @@ DataCall.prototype = {
addresses: aUpdatedDataCall.addresses ? aUpdatedDataCall.addresses.split(" ") : [],
dnses: aUpdatedDataCall.dnses ? aUpdatedDataCall.dnses.split(" ") : [],
gateways: aUpdatedDataCall.gateways ? aUpdatedDataCall.gateways.split(" ") : [],
pcscf: aUpdatedDataCall.pcscf ? aUpdatedDataCall.pcscf.split(" ") : []
pcscf: aUpdatedDataCall.pcscf ? aUpdatedDataCall.pcscf.split(" ") : [],
mtu: aUpdatedDataCall.mtu > 0 ? aUpdatedDataCall.mtu : 0
};
switch (dataCallState) {
@ -1173,6 +1180,7 @@ DataCall.prototype = {
this.linkInfo.gateways = newLinkInfo.gateways.slice();
this.linkInfo.dnses = newLinkInfo.dnses.slice();
this.linkInfo.pcscf = newLinkInfo.pcscf.slice();
this.linkInfo.mtu = newLinkInfo.mtu;
}
break;
case NETWORK_STATE_DISCONNECTED:
@ -1272,6 +1280,7 @@ DataCall.prototype = {
this.linkInfo.dnses = [];
this.linkInfo.gateways = [];
this.linkInfo.pcscf = [];
this.linkInfo.mtu = null;
},
reset: function() {
@ -1666,6 +1675,11 @@ RILNetworkInterface.prototype = {
return this.apnSetting.port || "";
},
get mtu() {
// Value provided by network has higher priority than apn settings.
return this.dataCall.linkInfo.mtu || this.apnSetting.mtu || -1;
},
// Helpers
debug: function(aMsg) {

View File

@ -393,7 +393,8 @@ DataCall.prototype = {
addreses: null,
dnses: null,
gateways: null,
pcscf: null
pcscf: null,
mtu: -1
};
function RadioInterfaceLayer() {

View File

@ -4,7 +4,7 @@
#include "nsISupports.idl"
[scriptable, uuid(88f18811-8f19-4902-a9b8-2a6430c71c94)]
[scriptable, uuid(6b66446a-7000-438f-8e1b-b56b4cbf4fa9)]
interface nsIDataCall : nsISupports
{
/**
@ -61,6 +61,11 @@ interface nsIDataCall : nsISupports
* IMS client.
*/
readonly attribute DOMString pcscf;
/**
* MTU received from network, -1 if not set or invalid.
*/
readonly attribute long mtu;
};
[scriptable, uuid(e119c54b-9354-4ad6-a1ee-18608bde9320)]

View File

@ -4536,6 +4536,11 @@ RilObject.prototype.readDataCall = function(options, version) {
options.pcscf = Buf.readString();
}
if (version >= 11) {
let mtu = Buf.readInt32();
options.mtu = (mtu > 0) ? mtu : -1 ;
}
return options;
};