|
楼主 |
发表于 2008-11-10 08:18:48
|
显示全部楼层
因为,我在咱们这个论坛上看到windows下缺省用的是ACE_WFMO_Reactor,最大只支持62个客户端,所以我就想换个别的reactor试试。
BOOL CoreApp::OnStart()
{
ACE::init();
m_util = new FEZCoreUtil;
m_util->ReadConfig();
SysParamData.distributePolicy = 1;
FEZCoreUtil::WriteLog("Read configure information start\r\n");
m_util->GetBoxs();
m_util->GetUsers();
/* 创建接收传真验证列表及顺序 */
m_util->GetRVPolicyList();
/* 创建按键验证列表及顺序 */
m_util->GetRVPressKeyList();
FEZCoreUtil::WriteLog("Read configure information end\r\n");
SysSykesBoxs = new CoreUserBox("", "");
FEZCoreUtil::WriteLog("Starting\r\n");
ACE_Select_Reactor * selectReactor = new ACE_Select_Reactor();
ACE_Reactor * coreReactor = new ACE_Reactor(selectReactor, 1);
ACE_Reactor::instance(coreReactor, 1);
ACE_INET_Addr port_to_listen(1999);
ACE_INET_Addr schedulerport_to_listen(SysParamData.schedulerPort);
ACE_INET_Addr converterport_to_listen(SysParamData.converterPort);
ACE_INET_Addr realinfoport_to_listen(2009);
ACE_INET_Addr realinfoport_to_connect(3456, ACE_LOCALHOST);
if ( g_clientAcceptor.open(port_to_listen) == -1 )
{
FEZCoreUtil::WriteLog("Listening port 1999 fail\r\n");
g_warn.sendWarning("Listening port 1999 fail");
return FALSE;
}
FEZCoreUtil::WriteLog("Listening port 1999 suc\r\n");
if ( g_schedulerAcceptor.open(schedulerport_to_listen) == -1 )
{
FEZCoreUtil::WriteLog("Listening port 2000 fail\r\n");
g_warn.sendWarning("Listening port 2000 fail");
return FALSE;
}
FEZCoreUtil::WriteLog("Listening port 2000 suc\r\n");
if ( g_converterAcceptor.open(converterport_to_listen) == -1 )
{
FEZCoreUtil::WriteLog("Listening port 2001 fail\r\n");
g_warn.sendWarning("Listening port 2001 fail");
return FALSE;
}
FEZCoreUtil::WriteLog("Listening port 2001 suc\r\n");
if ( g_realinfoAcceptor.open(realinfoport_to_listen) == -1 )
{
FEZCoreUtil::WriteLog("Listening port 2009 fail\r\n");
g_warn.sendWarning("Listening port 2009 fail");
return FALSE;
}
FEZCoreUtil::WriteLog("Listening port 2009 suc\r\n");
UINT threadid;
if ( -1L == _beginthreadex(NULL, 0, ClientAcceptorHandle, app, 0, &threadid) )
FEZCoreUtil::WriteLog("Create ClientAcceptorHandle thread fail\r\n");
else
FEZCoreUtil::WriteLog("Create ClientAcceptorHandle thread suc\r\n");
m_dbHandle = new DBHandle("FezCoreDBhandleEvent", 100);
if ( m_dbHandle )
FEZCoreUtil::WriteLog("Create DBHandle thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create DBHandle thread fail\r\n");
m_distributeManage = new DistributeManage("FezCoreDistributeManageEvent", 100);
if ( m_distributeManage )
FEZCoreUtil::WriteLog("Create DistributeManage thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create DistributeManage thread fail\r\n");
m_revValidateManage = new ReceiveValidateManage("FezCoreReceiveValidateEvent", 100);
if ( m_revValidateManage )
FEZCoreUtil::WriteLog("Create ReceiveValidateManage thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create ReceiveValidateManage thread fail\r\n");
m_revValidating = new ReceiveValidating("FezCoreReceiveValidatingEvent", 100);
if ( m_revValidating )
FEZCoreUtil::WriteLog("Create ReceiveValidating thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create ReceiveValidating thread fail\r\n");
m_loginManage = new LoginManage("FezCoreLoginManageEvent", 100);
if ( m_loginManage )
FEZCoreUtil::WriteLog("Create LoginManage thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create LoginManage thread fail\r\n");
m_clientCommuThread = new ClientCommunicate("FezCoreClientCommunicateEvent", 100);
if ( m_clientCommuThread )
FEZCoreUtil::WriteLog("Create ClientCommunicate thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create ClientCommunicate thread fail\r\n");
m_scheduCommuThread = new SchedulerCommunicate("FezCoreSchedulerCommunicateEvent", 100);
if ( m_scheduCommuThread )
FEZCoreUtil::WriteLog("Create SchedulerCommunicate thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create SchedulerCommunicate thread fail\r\n");
m_converterCommuThread = new ConverterCommunicate("FezCoreConverterCommunicateEvent", 100);
if ( m_converterCommuThread )
FEZCoreUtil::WriteLog("Create ConverterCommunicate thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create ConverterCommunicate thread fail\r\n");
m_mailCommuThread = new MailCommunicate("FezCoreMailCommunicateEvent",100);
if ( m_mailCommuThread )
FEZCoreUtil::WriteLog("Create MailCommunicate thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create MailCommunicate thread fail\r\n");
m_sendManageThread = new SendFaxManage("FezCoreSendMangeEvent", 100);
if ( m_sendManageThread )
FEZCoreUtil::WriteLog("Create SendFaxManage thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create SendFaxManage thread fail\r\n");
m_validateThread = new SendFaxValidating("FezCoreSendFaxTaskValidatingEvent", 100);
if ( m_validateThread )
FEZCoreUtil::WriteLog("Create SendFaxValidating thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create SendFaxValidating thread fail\r\n");
m_netSendThread = new NetSend("FezCoreNetSendEvent", 100);
if ( m_netSendThread )
FEZCoreUtil::WriteLog("Create NetSend thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create NetSend thread fail\r\n");
m_realInfo = new RealInfo("FezCoreRealInfoEvent", 100);
if ( m_realInfo )
FEZCoreUtil::WriteLog("Create RealInfo thread suc\r\n");
else
FEZCoreUtil::WriteLog("Create RealInfo thread fail\r\n");
return TRUE;
}
UINT WINAPI CoreApp::ClientAcceptorHandle(LPVOID s)
{
ACE_Reactor::instance()->run_reactor_event_loop();
return 1;
}
[ 本帖最后由 tiburon 于 2008-11-10 08:21 编辑 ] |
|