[Bugfix][T106BUG-526][T106BUG-505][data]Adjust SETUP_DATA_CALL timeout

Only Configure :No
Affected branch: master
Affected module: data
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: Yes

Change-Id: Ifad058d3bb1b3abf7453cb1b195466f5699f74c1
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
index 105d347..e73229a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
@@ -61,6 +61,7 @@
 
 int lynq_client_sockfd = 0;
 int Global_uToken = 0;
+int g_wait_time = 30;
 struct sockaddr_in lynq_data_socket_server_addr;
 int lynq_data_socket_server_addr_len;
 
@@ -368,7 +369,7 @@
 *  0:success
 *  other:failure
 */
-int wait_response(int sockfd,Parcel *& p,int utoken)
+int wait_response(int sockfd,Parcel *& p,int utoken,int timeout)
 {
     int len = 0;
     int flag = 1;
@@ -377,6 +378,16 @@
     int resp_type = -1;
     Parcel *temp = NULL;
     char recvline[LYNQ_REC_BUF];
+    struct timeval timeOut;
+
+    timeOut.tv_sec = timeout;
+    timeOut.tv_usec = 0;
+    
+    if (setsockopt(lynq_client_sockfd, SOL_SOCKET, SO_RCVTIMEO, &timeOut, sizeof(timeOut)) < 0) 
+    { 
+        LYERRLOG("time out setting failed,errno:%d",errno);
+        return -1;
+    }
     //Sometimes the socket is abnormal, causing the socket buffer to store the response of the last request.
     //Here it does not return until the response corresponding to the request is read.
     while(flag && (count < 20))//why?
@@ -1136,7 +1147,7 @@
         return LYNQ_E_NULL_ANONALY+2;
     }
     //get_response(lynq_client_sockfd,p);
-    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    error = wait_response(lynq_client_sockfd,p,client.uToken,g_wait_time);
     if(error!=0)
     {
         LYERRLOG("wait_response fail,ret:%d",error);
@@ -1222,7 +1233,7 @@
             return NULL;
         }
 
-        error = wait_response(lynq_client_sockfd,p,g_setup_utoken);
+        error = wait_response(lynq_client_sockfd,p,g_setup_utoken,g_wait_time);
         if(error!=0)
         {
             LYERRLOG("wait_response fail,ret:%d",error);
@@ -1410,7 +1421,7 @@
         return -1;
     }
     //get_response(lynq_client_sockfd,p);
-    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    error = wait_response(lynq_client_sockfd,p,client.uToken,g_wait_time);
     if(error!=0)
     {
         LYERRLOG("wait_response fail,ret:%d",error);
@@ -1647,7 +1658,7 @@
     }
 
     //get_response(lynq_client_sockfd,p);
-    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    error = wait_response(lynq_client_sockfd,p,client.uToken,120);
     if(error!=0)
     {
         LYERRLOG("wait_response fail,ret:%d",error);
@@ -1856,7 +1867,7 @@
         return LYNQ_E_NULL_ANONALY+2;
     }
     //get_response(lynq_client_sockfd,p);
-    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    error = wait_response(lynq_client_sockfd,p,client.uToken,g_wait_time);
     if(error!=0)
     {
         LYERRLOG("wait_response fail,ret:%d",error);
@@ -1959,7 +1970,7 @@
         return -1;
     }
     //get_response(lynq_client_sockfd,p);
-    error = wait_response(lynq_client_sockfd,p,client.uToken);
+    error = wait_response(lynq_client_sockfd,p,client.uToken,g_wait_time);
     if(error!=0)
     {
         LYERRLOG("wait_response fail,ret:%d",error);