Пример #1
0
//-----------------------------------------------------------------------------
// 伺服器IOCP執行
void C_XServer::ServerIOCP(IN S_XOverlapped *pOverlapped, IN unsigned long ulBytes, IN bool bResult)
{
	if(pOverlapped == nullptr)
		return;

	m_ccKernal.BenchmarkIOCPStart();

	switch(pOverlapped->emType)
	{
	case ENUM_XOverlapped_Accept:
		AcceptFinish(*pOverlapped, ulBytes, bResult);
		break;

	case ENUM_XOverlapped_Recv:
		RecvFinish(*pOverlapped, ulBytes, bResult);
		break;

	case ENUM_XOverlapped_Send:
		SendFinish(*pOverlapped, ulBytes, bResult);
		break;

	default:
		C_NOutput::Instance().Error(ERRORNSTD, __T("unknow overlapped type"));
		break;
	}//switch

	m_ccKernal.BenchmarkIOCPEnd();
}
Пример #2
0
void IoFinish(int32_t bytestransfer,st_io *io,uint32_t err_code)
{
    struct OVERLAPCONTEXT *OVERLAP = (struct OVERLAPCONTEXT *)io;
    struct connection *c = OVERLAP->c;
	acquire_conn(c);
    if(io == (st_io*)&c->send_overlap)
        SendFinish(bytestransfer,c,err_code);
    else if(io == (st_io*)&c->recv_overlap)
        RecvFinish(bytestransfer,c,err_code);
	release_conn(c);
}