本文整理汇总了C++中CChannel::KillUserLink方法的典型用法代码示例。如果您正苦于以下问题:C++ CChannel::KillUserLink方法的具体用法?C++ CChannel::KillUserLink怎么用?C++ CChannel::KillUserLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChannel
的用法示例。
在下文中一共展示了CChannel::KillUserLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRequestChangeChannel
int OnRequestChangeChannel( LPSOCKETCONTEXT lpSockContext, char *cpPacket )
{
CCoder coder;
CChannel *pChannel = &Server.ch[lpSockContext->iChannel];
CRoom *pRoom;
char cChannel,
cPacket[32],
*pOffset;
int newProcess,
iNext,
iSize;
short dummy;
// ---- 유저 링크 제거 ----
pChannel->KillUserLink( lpSockContext->index );
// ---- 유저 퇴장을 통보 ----
coder.SetBuf( cPacket );
coder.PutChar( lpSockContext->idLen );
coder.PutText( lpSockContext->cID, lpSockContext->idLen );
iSize = coder.SetHeader( NOTIFY_USERDELETE );
PostTcpSend( pChannel->iUserBegin, cPacket, iSize );
iNext = pChannel->iUsedRoomBegin;
while( iNext != NOTLINKED )
{
pRoom = &Server.rm[iNext];
PostTcpSend( pRoom->iUserBegin, cPacket, iSize );
iNext = Server.rn[iNext].next;
}
coder.SetBuf( cpPacket );
coder.GetChar( &cChannel ); // 이동하려는 채널 번호
coder.SetBuf( cPacket );
#ifdef _LOGLEVEL3_
DConsole.Output( "OnRequestChangeChannel(%d) : %d\n", lpSockContext->index, cChannel );
#endif
lpSockContext->iChannel = cChannel;
newProcess = cChannel / Server.iMaxChannelInProcess;
if( lpSockContext->iProcess == newProcess )
{
// ---- 같은 쓰레드 내에서는 직접 호출 ----
OnRequestChangeChannelInt( lpSockContext, cpPacket );
}
else
{
lpSockContext->iProcess = newProcess;
// ---- 중요한 작업 ----
// ---- cpRTBegin 을 되감아서 다른 쓰레드가 그것을 처리할 수 있도록 한다 ----
lpSockContext->cpRTBegin = cpPacket;
dummy = REQUEST_CHANGECHANNEL_INT;
pOffset = cpPacket + sizeof( short );
if( pOffset >= lpSockContext->cRecvTcpRingBuf + RINGBUFSIZE )
{
pOffset -= RINGBUFSIZE;
CopyMemory( pOffset, &dummy, sizeof( short ) );
}
else
{
CopyMemory( pOffset, &dummy, sizeof( short ) );
dummy = lpSockContext->cRecvTcpRingBuf + RINGBUFSIZE - pOffset;
if( dummy < sizeof( short) )
{
*lpSockContext->cRecvTcpRingBuf = *(lpSockContext->cRecvTcpRingBuf + RINGBUFSIZE);
}
}
Server.ps[newProcess].GameBufEnqueue( lpSockContext );
}
return 1;
}