diff --git a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c index 728598a3b..1942325e3 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c @@ -892,6 +892,7 @@ SINT32 sf_pic_send_ftp(void) //SINT64 sendStartTime = 0; UINT8 sendAlreadyFlag = 0; UINT8 timeoutCnt = 0; + int sendcnt = 0; SF_SRCFILE_ATTR_S *pThumbFileCfg = sf_file_thumb_cfg_get(); MLOGD("start\n"); @@ -964,10 +965,20 @@ SINT32 sf_pic_send_ftp(void) if(SF_SUCCESS == ret) { - ret = sf_ftp_send(ftpFileName[pic], filePath[pic], timeout); pSifarPara->TotalPicsSent++; + + SF_SEND_RE: + ret = sf_ftp_send(ftpFileName[pic], filePath[pic], timeout); + if(SF_SUCCESS != ret) { + if(!sendcnt) + { + sendcnt++; + MLOGE(" Send an error and retry. ret:[0x%08X]\n", ret); + sleep(1); + goto SF_SEND_RE; + } pSifarPara->picSendFailCount++; pSifarPara->sendThumbnailFailCount++; //TIMEOUT @@ -981,6 +992,7 @@ SINT32 sf_pic_send_ftp(void) sf_log_error_code(logStr); } else { + sendcnt = 0; if(!sf_get_mode_flag()){ pSifarPara->picSendMax++; if(!sf_get_pic()) @@ -1065,6 +1077,7 @@ SINT32 sf_video_send_ftp(void) int timeout = 120000; UINT8 fileIndex = 0; UINT8 csqlevel = 0; + int sendcnt = 0; SF_SRCFILE_ATTR_S *pThumbFileCfg = sf_file_thumb_cfg_get(); MLOGD("start\n"); @@ -1096,10 +1109,18 @@ SINT32 sf_video_send_ftp(void) } else { + SF_SEND_RE: ret = sf_ftp_send(ftpFileName, filePath, timeout); if(SF_SUCCESS != ret) { + if(!sendcnt) + { + sendcnt++; + MLOGE(" Send an error and retry. ret:[0x%08X]\n", ret); + sleep(1); + goto SF_SEND_RE; + } printf("%s:%d err ret: [0x%08X] ftpFileName:%s filePath:%s\n", __FUNCTION__, __LINE__, ret, ftpFileName, filePath); SF_SPRINTF(logStr, "%x,", SF_ERR_ID(SF_MOD_FTP, ret)); sf_log_error_code(logStr); @@ -1118,6 +1139,8 @@ SINT32 sf_ftp_lpa_log_send(void) UINT8 lpaFile[64] = { 0 }; UINT8 filePath[64] = { 0 }; int timeout = 60000; + int sendcnt = 0; + MLOGD("start\n"); printf("%s:%d filePath:%s\n", __FUNCTION__, __LINE__, filePath); @@ -1132,10 +1155,18 @@ SINT32 sf_ftp_lpa_log_send(void) } else { + SF_SEND_RE: ret = sf_ftp_send(lpaFile, filePath, timeout); if(SF_SUCCESS != ret) { + if(!sendcnt) + { + sendcnt++; + MLOGE(" Send an error and retry. ret:[0x%08X]\n", ret); + sleep(1); + goto SF_SEND_RE; + } printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); } } @@ -1153,6 +1184,7 @@ SINT32 sf_ftp_dailyreport_send(void) UINT8 customStr[64] = { 0 }; UINT8 filePath[64] = { 0 }; int timeout = 60000; + int sendcnt = 0; UIMenuStoreInfo *pPara = sf_app_ui_para_get(); SF_PDT_PARAM_STATISTICS_S *pSifarPara = sf_statistics_param_get(); @@ -1179,10 +1211,18 @@ SINT32 sf_ftp_dailyreport_send(void) } else { + SF_SEND_RE: ret = sf_ftp_send(uploadFname, filePath, timeout); if(SF_SUCCESS != ret) { + if(!sendcnt) + { + sendcnt++; + MLOGE(" Send an error and retry. ret:[0x%08X]\n", ret); + sleep(1); + goto SF_SEND_RE; + } printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); SF_SPRINTF(logStr, "%x,", SF_ERR_ID(SF_MOD_FTP, ret)); sf_log_error_code(logStr);