[Bugfix][API-1220][DATA]data call handle value more than the number of apn channels being used
Only Configure: No
Affected branch: All branch
Affected module: DATA
Is it affected on both ZXIC and MTK: Yes
Self-test: Yes
Doc Update: No
Change-Id: I15bdbf6433c645c87481a20f80850c3326a4620e
diff --git a/lib/liblynq-data/lynq_data.cpp b/lib/liblynq-data/lynq_data.cpp
index f73b76f..1351300 100755
--- a/lib/liblynq-data/lynq_data.cpp
+++ b/lib/liblynq-data/lynq_data.cpp
@@ -232,6 +232,36 @@
}
return ret;
}
+//@return
+//other:this apn has been used in apn table
+//-1:this apn not has been used in apn table
+int check_used_apn(char apnType[])
+{
+ LYINFLOG("check_used_apn.apnType:%s",apnType);
+ int ret = 0;
+ int len = 0;
+ for(ret;ret<LYNQ_APN_CHANNEL_MAX;ret++)
+ {
+ len = strlen(apnType);
+ if(strncmp(lynq_apn_table[ret].apnType,apnType,len)==0)
+ {
+ LYINFLOG("check_used_apn.apnType:%s in apn table",apnType);
+ return ret;
+ }
+ }
+ return -1;
+}
+int get_handle(char apnType[])
+{
+ int call_id = 0;
+ call_id = check_used_apn(apnType);
+ if(call_id == -1)
+ {
+ call_id = updateApn(apnType);
+ }
+ LYINFLOG("handle:%d",call_id);
+ return call_id;
+}
int handleCheck(int handle)
{
@@ -914,7 +944,7 @@
client.paramLen = 0;
bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
- lynq_data_call_id = updateApn("default");
+ lynq_data_call_id = get_handle("default");
if (lynq_data_call_id < 0)
{
LYERRLOG("update apn table fail error id = %d",lynq_data_call_id);
@@ -1119,7 +1149,7 @@
sprintf(client.param,"%s %s %s %s %s %s %s",apn,apnType,argv[1],argv[2],argv[3],argv[4],argv[5]);
#endif //GSW_RIL_CFG
LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
- lynq_data_call_id = updateApn(apnType);
+ lynq_data_call_id = get_handle(apnType);
if (lynq_data_call_id < 0)
{
LYERRLOG("update apn table fail error id = %d",lynq_data_call_id);