KeepAlive.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "KeepAlive.h"
  2. #include "../Global/Variablen.h"
  3. // Inhalt der KeepAliveTh Klasse aus KeepAlive.h
  4. // Konstruktor
  5. KeepAliveTh::KeepAliveTh()
  6. : Thread()
  7. {
  8. exit = 0;
  9. start();
  10. }
  11. // nicht constant
  12. void KeepAliveTh::thread()
  13. {
  14. while( !exit )
  15. {
  16. if( loginClient && loginClient->istVerbunden() )
  17. loginClient->keepAlive();
  18. if( registerClient && registerClient->istVerbunden() )
  19. registerClient->keepAlive();
  20. if( infoClient && infoClient->istVerbunden() )
  21. infoClient->keepAlive();
  22. if( chatClient && chatClient->istVerbunden() )
  23. chatClient->keepAlive();
  24. if( anmeldungClient && anmeldungClient->istVerbunden() )
  25. anmeldungClient->keepAlive();
  26. if( spielClient && spielClient->istVerbunden() )
  27. spielClient->keepAlive();
  28. if( shopClient && shopClient->istVerbunden() )
  29. shopClient->keepAlive();
  30. if( newsClient && newsClient->istVerbunden() )
  31. newsClient->keepAlive();
  32. if( editorClient && editorClient->istVerbunden() )
  33. editorClient->keepAlive();
  34. if( minigameClient && minigameClient->istVerbunden() )
  35. minigameClient->keepAlive();
  36. for( int i = 0; i < 300 && !exit; i++ )
  37. Sleep( 100 );
  38. }
  39. run = 0;
  40. }
  41. void KeepAliveTh::doExit()
  42. {
  43. exit = 1;
  44. }