Advertisement
qben360

Untitled

Apr 2nd, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. void Protocol76::ReceiveLoop()
  2. {
  3.     NetworkMessage msg;
  4.     msg.setEncryptionState(true);
  5.     msg.setEncryptionKey(m_key);
  6.     do
  7.     {
  8.         while(pendingLogout == false && msg.ReadFromSocket(s))
  9.         {
  10.             parsePacket(msg);
  11.         }
  12.  
  13.         if(s)
  14.         {
  15.             closesocket(s);
  16.             s = 0;
  17.         }
  18.        // logout by disconnect?  -> kick
  19.         if(pendingLogout == false){
  20.             game->playerSetAttackedCreature(player, 0);
  21.             while(player->inFightTicks >= 1000 && player->isRemoved == false && s == 0)
  22.             {
  23.                 OTSYS_SLEEP(250);
  24.             }
  25.             OTSYS_THREAD_LOCK(game->gameLock, "Protocol76::ReceiveLoop()")
  26.             if(player->isRemoved == false)
  27.             {
  28.                 if(s == 0)
  29.                 {
  30.                     game->removeCreature(player);
  31.                 }
  32.                 else
  33.                 {
  34.                     msg.setEncryptionKey(m_key);
  35.                 }
  36.             }
  37.             OTSYS_THREAD_UNLOCK(game->gameLock, "Protocol76::ReceiveLoop()")
  38.         }
  39.     }
  40.     while(s != 0 && player->isRemoved == false);
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement