Closed GoogleCodeExporter closed 8 years ago
code:
DWORD WINAPI StartServer(LPVOID para)
{
SP_IocpServer* pServer = (SP_IocpServer*)para;
pServer->run();
while (pServer->isRunning())
{
Sleep(1000);
}
return 0;
}
void CHostListView::OnStartlisten()
{
int port = 80, maxThreads = 50;
const char * serverType = "hahs";
if( 0 != sp_initsock() ) ASSERT( 0 );
m_pIocpServer =
new SP_IocpServer( "", port, new SP_HttpHandlerAdapterFactory( new
CHttpServerHandlerFactory(this->m_hWnd) ) );
m_pIocpServer->setTimeout( 60 );
m_pIocpServer->setMaxThreads( maxThreads );
m_pIocpServer->setReqQueueSize( 100, "HTTP/1.1 500 Sorry, server is busy
now!\r\n" );
DWORD dwThreadId1;
m_hStartServerThread = CreateThread( NULL, 0, StartServer,
(LPVOID)(m_pIocpServer), 0, &dwThreadId1 );
sp_closelog();
}
close:
if (m_pIocpServer)
{
if (m_pIocpServer->isRunning())
{
m_pIocpServer->shutdown();
}
WaitForSingleObject(m_hStartServerThread,INFINITE);
delete m_pIocpServer;
}
Original comment by zl110...@163.com
on 18 Feb 2009 at 3:31
I used in mfc program there is memory leak,but in the console program there is
none!
Original comment by zl110...@163.com
on 20 Feb 2009 at 12:42
Original comment by stephen....@gmail.com
on 26 Feb 2009 at 7:25
Original issue reported on code.google.com by
zl110...@163.com
on 18 Feb 2009 at 3:26