Files
LGram16 dd97ddec92 Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:17:20 +09:00

65 lines
1.6 KiB
C++

#include "stdafx.h"
#include "IOWorker.h"
#include "Overlapped.h"
#include "../IOCP/CompletionHandler.h"
#include "../Session/Session.h"
#include "../Listener/Listener.h"
#include <Log/ServerLog.h>
CIOWorker::CIOWorker(CCompletionHandler& SocketHandler)
: m_SocketHandler(SocketHandler)
{
}
CIOWorker::~CIOWorker()
{
}
unsigned int CIOWorker::Run()
{
COverlapped* lpOverlapped = 0;
while(true)
{
unsigned long dwProcessedBytes = 0;
ULONG_PTR lpSessionKey = 0;
OVERLAPPED* lpOverlappedStruct = 0;
BOOL bResult = m_SocketHandler.GetHanderStatus(&dwProcessedBytes,
&lpSessionKey, &lpOverlappedStruct);
if(0 == lpSessionKey)
{
DETLOG4(g_SessionLog, "SP:0x%p/lpOverlapped:0x%p/bResult:%s/Thread 0x%p Completed",
lpSessionKey, lpOverlappedStruct, bResult ? "T" : "F", GetCurrentThreadId());
break;
}
if(!bResult && 0 == lpOverlappedStruct)
{
// 알 수 없는 에러, 혹은 타임아웃.
DETLOG4(g_SessionLog, "SP:0x%p/lpOverlapped:0x%p/bResult:%s/GetQueuedCompletionStatus error : %u",
lpSessionKey, lpOverlappedStruct, bResult ? "T" : "F", WSAGetLastError());
}
else
{
// Recv, Send, Accept를 함.
lpOverlapped = static_cast<COverlapped*>(lpOverlappedStruct);
lpOverlapped->Dispatch(bResult, lpSessionKey, dwProcessedBytes);
}
}
return 0;
}
BOOL CIOWorker::End()
{
m_SocketHandler.PostToHandler(0, 0, 0);
return true;
}