mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
[Network] refactoring
This commit is contained in:
@ -56,11 +56,6 @@ namespace NSNetwork
|
|||||||
m_cData = NULL;
|
m_cData = NULL;
|
||||||
m_nSize = 0;
|
m_nSize = 0;
|
||||||
|
|
||||||
m_sResponse = L"";
|
|
||||||
|
|
||||||
|
|
||||||
m_func_onComplete = nullptr;
|
|
||||||
m_func_onProgress = nullptr;
|
|
||||||
|
|
||||||
m_bIsExit = nullptr;
|
m_bIsExit = nullptr;
|
||||||
}
|
}
|
||||||
@ -79,11 +74,6 @@ namespace NSNetwork
|
|||||||
m_cData = cData;
|
m_cData = cData;
|
||||||
m_nSize = nSize;
|
m_nSize = nSize;
|
||||||
|
|
||||||
m_sResponse = L"";
|
|
||||||
|
|
||||||
|
|
||||||
m_func_onComplete = nullptr;
|
|
||||||
m_func_onProgress = nullptr;
|
|
||||||
|
|
||||||
m_bIsExit = nullptr;
|
m_bIsExit = nullptr;
|
||||||
}
|
}
|
||||||
@ -102,11 +92,6 @@ namespace NSNetwork
|
|||||||
m_cData = NULL;
|
m_cData = NULL;
|
||||||
m_nSize = 0;
|
m_nSize = 0;
|
||||||
|
|
||||||
m_sResponse = L"";
|
|
||||||
|
|
||||||
|
|
||||||
m_func_onComplete = nullptr;
|
|
||||||
m_func_onProgress = nullptr;
|
|
||||||
|
|
||||||
m_bIsExit = nullptr;
|
m_bIsExit = nullptr;
|
||||||
}
|
}
|
||||||
@ -146,10 +131,10 @@ namespace NSNetwork
|
|||||||
const unsigned char* m_cData; // Данные в сыром виде для выгрузки
|
const unsigned char* m_cData; // Данные в сыром виде для выгрузки
|
||||||
int m_nSize; // Размер данных
|
int m_nSize; // Размер данных
|
||||||
|
|
||||||
std::wstring m_sResponse; // Ответ сервера
|
std::wstring m_sResponse = L""; // Ответ сервера
|
||||||
|
|
||||||
std::function<void(int)> m_func_onComplete;
|
std::function<void(int)> m_func_onComplete = nullptr;
|
||||||
std::function<void(int)> m_func_onProgress;
|
std::function<void(int)> m_func_onProgress = nullptr;
|
||||||
|
|
||||||
std::atomic<bool>* m_bIsExit; // Для остановки и выхода потока
|
std::atomic<bool>* m_bIsExit; // Для остановки и выхода потока
|
||||||
};
|
};
|
||||||
|
|||||||
@ -60,19 +60,16 @@ namespace NSNetwork
|
|||||||
CFileTransporterBaseWin(const std::wstring &sDownloadFileUrl, bool bDelete = true) :
|
CFileTransporterBaseWin(const std::wstring &sDownloadFileUrl, bool bDelete = true) :
|
||||||
CFileTransporterBase(sDownloadFileUrl, bDelete)
|
CFileTransporterBase(sDownloadFileUrl, bDelete)
|
||||||
{
|
{
|
||||||
m_pFile = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileTransporterBaseWin(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) :
|
CFileTransporterBaseWin(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) :
|
||||||
CFileTransporterBase(sUploadUrl, cData, nSize)
|
CFileTransporterBase(sUploadUrl, cData, nSize)
|
||||||
{
|
{
|
||||||
m_pFile = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileTransporterBaseWin(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) :
|
CFileTransporterBaseWin(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) :
|
||||||
CFileTransporterBase(sUploadUrl, sUploadFilePath)
|
CFileTransporterBase(sUploadUrl, sUploadFilePath)
|
||||||
{
|
{
|
||||||
m_pFile = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~CFileTransporterBaseWin()
|
virtual ~CFileTransporterBaseWin()
|
||||||
@ -124,7 +121,7 @@ namespace NSNetwork
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FILE *m_pFile; // Хэндл на временный файл
|
FILE * m_pFile = nullptr; // Хэндл на временный файл
|
||||||
unsigned int _DownloadFile(std::wstring sFileUrl)
|
unsigned int _DownloadFile(std::wstring sFileUrl)
|
||||||
{
|
{
|
||||||
// Проверяем состояние соединения
|
// Проверяем состояние соединения
|
||||||
@ -490,18 +487,18 @@ namespace NSNetwork
|
|||||||
};
|
};
|
||||||
|
|
||||||
CFileTransporter_private::CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete)
|
CFileTransporter_private::CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete)
|
||||||
|
: m_pInternal(new CFileTransporterBaseWin(sDownloadFileUrl, bDelete))
|
||||||
{
|
{
|
||||||
m_pInternal = new CFileTransporterBaseWin(sDownloadFileUrl, bDelete);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize)
|
CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize)
|
||||||
|
: m_pInternal(new CFileTransporterBaseWin(sUploadUrl, cData, nSize))
|
||||||
{
|
{
|
||||||
m_pInternal = new CFileTransporterBaseWin(sUploadUrl, cData, nSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath)
|
CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath)
|
||||||
|
: m_pInternal(new CFileTransporterBaseWin(sUploadUrl, sUploadFilePath))
|
||||||
{
|
{
|
||||||
m_pInternal = new CFileTransporterBaseWin(sUploadUrl, sUploadFilePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,16 +96,15 @@ namespace NSThreads
|
|||||||
{
|
{
|
||||||
friend class CBaseThread;
|
friend class CBaseThread;
|
||||||
private:
|
private:
|
||||||
HANDLE m_thread;
|
HANDLE m_thread = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
__native_thread() : CThreadDescriptor()
|
__native_thread() : CThreadDescriptor()
|
||||||
{
|
{
|
||||||
m_thread = NULL;
|
|
||||||
}
|
}
|
||||||
virtual ~__native_thread()
|
virtual ~__native_thread()
|
||||||
{
|
{
|
||||||
if (m_thread != NULL)
|
if (m_thread)
|
||||||
{
|
{
|
||||||
CloseHandle(m_thread);
|
CloseHandle(m_thread);
|
||||||
m_thread = NULL;
|
m_thread = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user