Пример #1
0
void tLibs3::ProcessFinished( int exitCode, QProcess::ExitStatus exitStatus )
{
#ifdef DATATRANSFERMANAGER_DBG
    DbgPrintf( QString("%1(%2, %3)").arg(__FUNCTION__).arg(exitCode, 0, 16).arg(exitStatus) );
#endif // DATATRANSFERMANAGER_DBG

    tTransfer* pTransfer = 0;

    m_Mutex.lock();
    if ( m_Transfers.isEmpty() == false )
    {
        pTransfer = m_Transfers.takeFirst();
    }
    m_Mutex.unlock();

    if( pTransfer != 0 )
    {
        if( ( exitCode == 0 ) && ( exitStatus == QProcess::NormalExit ) && ( m_Error.isEmpty()) )
        {
            // Inform the tTransferManager that the compress completed successfully
            emit UploadComplete( pTransfer );
        }
        else
        {
            // Inform the tTransferManager that an error occurred during compression
            emit UploadError( pTransfer );
        }
    }

    // Start uploading the next file
    StartNextFile();
}
Пример #2
0
int CMeterUploader::UploadFileList(char **pList, int nCount)
{
	time_t	    tmUpload, now;
	int		i,j, nSuccess=0;
    int         retryCount=10;
    BOOL    getPermit;

	time(&tmUpload);

	for(i=0; i<nCount; i++)
	{	
		// 제한 시간이 초과되면 중단.
		time(&now);
		if ((int)abs(((now-tmUpload)/60)) > m_nUploadTryTime)
			break;

        for(j=0; j<retryCount; j++) {
            if((getPermit=SetBusyFile(pList[i]))) break;
            usleep(100000);
        }
        if(!getPermit) {
            XDEBUG("Get File Handle fail : %s\r\n", pList[i]);
            break;
        } 
		XDEBUG("Upload try : %s\r\n", pList[i]);
		if (!UploadFile(pList[i]))
		{
		    XDEBUG("Upload fail : %s\r\n", pList[i]);
            ResetBusyFile(pList[i]);
			break;
		}
		XDEBUG("Upload success : %s\r\n", pList[i]);

        UploadComplete(pList[i]);        
        ResetBusyFile(pList[i]);

        nSuccess ++;
	}

	return nSuccess;
}