CServerHandler.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. /*
  2. * CServerHandler.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "CServerHandler.h"
  12. #include "Client.h"
  13. #include "CGameInfo.h"
  14. #include "CPlayerInterface.h"
  15. #include "gui/CGuiHandler.h"
  16. #include "lobby/CSelectionBase.h"
  17. #include "lobby/CLobbyScreen.h"
  18. #include "mainmenu/CMainMenu.h"
  19. #ifndef VCMI_ANDROID
  20. #include "../lib/Interprocess.h"
  21. #endif
  22. #include "../lib/CConfigHandler.h"
  23. #include "../lib/CGeneralTextHandler.h"
  24. #include "../lib/CThreadHelper.h"
  25. #include "../lib/NetPacks.h"
  26. #include "../lib/StartInfo.h"
  27. #include "../lib/VCMIDirs.h"
  28. #include "../lib/mapping/CCampaignHandler.h"
  29. #include "../lib/mapping/CMap.h"
  30. #include "../lib/mapping/CMapInfo.h"
  31. #include "../lib/mapObjects/MiscObjects.h"
  32. #include "../lib/rmg/CMapGenOptions.h"
  33. #include "../lib/registerTypes/RegisterTypes.h"
  34. #include "../lib/serializer/Connection.h"
  35. #include "../lib/serializer/CMemorySerializer.h"
  36. #include <boost/uuid/uuid.hpp>
  37. #include <boost/uuid/uuid_io.hpp>
  38. #include <boost/uuid/uuid_generators.hpp>
  39. template<typename T> class CApplyOnLobby;
  40. class CBaseForLobbyApply
  41. {
  42. public:
  43. virtual bool applyOnLobbyHandler(CServerHandler * handler, void * pack) const = 0;
  44. virtual void applyOnLobbyScreen(CLobbyScreen * lobby, CServerHandler * handler, void * pack) const = 0;
  45. virtual ~CBaseForLobbyApply(){};
  46. template<typename U> static CBaseForLobbyApply * getApplier(const U * t = nullptr)
  47. {
  48. return new CApplyOnLobby<U>();
  49. }
  50. };
  51. template<typename T> class CApplyOnLobby : public CBaseForLobbyApply
  52. {
  53. public:
  54. bool applyOnLobbyHandler(CServerHandler * handler, void * pack) const override
  55. {
  56. T * ptr = static_cast<T *>(pack);
  57. logNetwork->trace("\tImmidiately apply on lobby: %s", typeList.getTypeInfo(ptr)->name());
  58. return ptr->applyOnLobbyHandler(handler);
  59. }
  60. void applyOnLobbyScreen(CLobbyScreen * lobby, CServerHandler * handler, void * pack) const override
  61. {
  62. T * ptr = static_cast<T *>(pack);
  63. logNetwork->trace("\tApply on lobby from queue: %s", typeList.getTypeInfo(ptr)->name());
  64. ptr->applyOnLobbyScreen(lobby, handler);
  65. }
  66. };
  67. template<> class CApplyOnLobby<CPack>: public CBaseForLobbyApply
  68. {
  69. public:
  70. bool applyOnLobbyHandler(CServerHandler * handler, void * pack) const override
  71. {
  72. logGlobal->error("Cannot apply plain CPack!");
  73. assert(0);
  74. return false;
  75. }
  76. void applyOnLobbyScreen(CLobbyScreen * lobby, CServerHandler * handler, void * pack) const override
  77. {
  78. logGlobal->error("Cannot apply plain CPack!");
  79. assert(0);
  80. }
  81. };
  82. extern std::string NAME;
  83. CServerHandler::CServerHandler()
  84. : state(EClientState::NONE), mx(std::make_shared<boost::recursive_mutex>()), client(nullptr), loadMode(0), campaignStateToSend(nullptr)
  85. {
  86. uuid = boost::uuids::to_string(boost::uuids::random_generator()());
  87. applier = std::make_shared<CApplier<CBaseForLobbyApply>>();
  88. registerTypesLobbyPacks(*applier);
  89. }
  90. void CServerHandler::resetStateForLobby(const StartInfo::EMode mode, const std::vector<std::string> * names)
  91. {
  92. hostClientId = -1;
  93. state = EClientState::NONE;
  94. th = make_unique<CStopWatch>();
  95. packsForLobbyScreen.clear();
  96. c.reset();
  97. si.reset(new StartInfo());
  98. playerNames.clear();
  99. si->difficulty = 1;
  100. si->mode = mode;
  101. myNames.clear();
  102. if(names && !names->empty()) //if have custom set of player names - use it
  103. myNames = *names;
  104. else
  105. myNames.push_back(settings["general"]["playerName"].String());
  106. #ifndef VCMI_ANDROID
  107. shm.reset();
  108. if(!settings["session"]["disable-shm"].Bool())
  109. {
  110. std::string sharedMemoryName = "vcmi_memory";
  111. if(settings["session"]["enable-shm-uuid"].Bool())
  112. {
  113. //used or automated testing when multiple clients start simultaneously
  114. sharedMemoryName += "_" + uuid;
  115. }
  116. try
  117. {
  118. shm = std::make_shared<SharedMemory>(sharedMemoryName, true);
  119. }
  120. catch(...)
  121. {
  122. shm.reset();
  123. logNetwork->error("Cannot open interprocess memory. Continue without it...");
  124. }
  125. }
  126. #endif
  127. }
  128. void CServerHandler::startLocalServerAndConnect()
  129. {
  130. if(threadRunLocalServer)
  131. threadRunLocalServer->join();
  132. th->update();
  133. #ifdef VCMI_ANDROID
  134. CAndroidVMHelper envHelper;
  135. envHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "startServer", true);
  136. #else
  137. threadRunLocalServer = std::make_shared<boost::thread>(&CServerHandler::threadRunServer, this); //runs server executable;
  138. #endif
  139. logNetwork->trace("Setting up thread calling server: %d ms", th->getDiff());
  140. th->update();
  141. #ifndef VCMI_ANDROID
  142. if(shm)
  143. shm->sr->waitTillReady();
  144. #else
  145. logNetwork->info("waiting for server");
  146. while(!androidTestServerReadyFlag.load())
  147. {
  148. logNetwork->info("still waiting...");
  149. boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
  150. }
  151. logNetwork->info("waiting for server finished...");
  152. androidTestServerReadyFlag = false;
  153. #endif
  154. logNetwork->trace("Waiting for server: %d ms", th->getDiff());
  155. th->update(); //put breakpoint here to attach to server before it does something stupid
  156. #ifndef VCMI_ANDROID
  157. justConnectToServer(settings["server"]["server"].String(), shm ? shm->sr->port : 0);
  158. #else
  159. justConnectToServer(settings["server"]["server"].String());
  160. #endif
  161. logNetwork->trace("\tConnecting to the server: %d ms", th->getDiff());
  162. }
  163. void CServerHandler::justConnectToServer(const std::string & addr, const ui16 port)
  164. {
  165. state = EClientState::CONNECTING;
  166. while(!c && state != EClientState::CONNECTION_CANCELLED)
  167. {
  168. try
  169. {
  170. logNetwork->info("Establishing connection...");
  171. c = std::make_shared<CConnection>(
  172. addr.size() ? addr : settings["server"]["server"].String(),
  173. port ? port : getDefaultPort(),
  174. NAME, uuid);
  175. }
  176. catch(...)
  177. {
  178. logNetwork->error("\nCannot establish connection! Retrying within 1 second");
  179. boost::this_thread::sleep(boost::posix_time::seconds(1));
  180. }
  181. }
  182. if(state == EClientState::CONNECTION_CANCELLED)
  183. logNetwork->info("Connection aborted by player!");
  184. else
  185. c->handler = std::make_shared<boost::thread>(&CServerHandler::threadHandleConnection, this);
  186. }
  187. void CServerHandler::applyPacksOnLobbyScreen()
  188. {
  189. if(!c || !c->handler)
  190. return;
  191. boost::unique_lock<boost::recursive_mutex> lock(*mx);
  192. while(!packsForLobbyScreen.empty())
  193. {
  194. CPackForLobby * pack = packsForLobbyScreen.front();
  195. packsForLobbyScreen.pop_front();
  196. CBaseForLobbyApply * apply = applier->getApplier(typeList.getTypeID(pack)); //find the applier
  197. apply->applyOnLobbyScreen(static_cast<CLobbyScreen *>(SEL), this, pack);
  198. GH.totalRedraw();
  199. delete pack;
  200. }
  201. }
  202. void CServerHandler::stopServerConnection()
  203. {
  204. if(c->handler)
  205. {
  206. while(!c->handler->timed_join(boost::posix_time::milliseconds(50)))
  207. applyPacksOnLobbyScreen();
  208. c->handler->join();
  209. }
  210. }
  211. std::set<PlayerColor> CServerHandler::getHumanColors()
  212. {
  213. return clientHumanColors(c->connectionID);
  214. }
  215. PlayerColor CServerHandler::myFirstColor() const
  216. {
  217. return clientFirstColor(c->connectionID);
  218. }
  219. bool CServerHandler::isMyColor(PlayerColor color) const
  220. {
  221. return isClientColor(c->connectionID, color);
  222. }
  223. ui8 CServerHandler::myFirstId() const
  224. {
  225. return clientFirstId(c->connectionID);
  226. }
  227. bool CServerHandler::isServerLocal() const
  228. {
  229. if(threadRunLocalServer)
  230. return true;
  231. return false;
  232. }
  233. bool CServerHandler::isHost() const
  234. {
  235. return c && hostClientId == c->connectionID;
  236. }
  237. bool CServerHandler::isGuest() const
  238. {
  239. return !c || hostClientId != c->connectionID;
  240. }
  241. ui16 CServerHandler::getDefaultPort()
  242. {
  243. if(settings["session"]["serverport"].Integer())
  244. return settings["session"]["serverport"].Integer();
  245. else
  246. return settings["server"]["port"].Integer();
  247. }
  248. std::string CServerHandler::getDefaultPortStr()
  249. {
  250. return boost::lexical_cast<std::string>(getDefaultPort());
  251. }
  252. void CServerHandler::sendClientConnecting() const
  253. {
  254. LobbyClientConnected lcc;
  255. lcc.uuid = uuid;
  256. lcc.names = myNames;
  257. lcc.mode = si->mode;
  258. sendLobbyPack(lcc);
  259. }
  260. void CServerHandler::sendClientDisconnecting()
  261. {
  262. // FIXME: This is workaround needed to make sure client not trying to sent anything to non existed server
  263. if(state == EClientState::DISCONNECTING)
  264. return;
  265. state = EClientState::DISCONNECTING;
  266. LobbyClientDisconnected lcd;
  267. lcd.clientId = c->connectionID;
  268. logNetwork->info("Connection has been requested to be closed.");
  269. if(isServerLocal())
  270. {
  271. lcd.shutdownServer = true;
  272. logNetwork->info("Sent closing signal to the server");
  273. }
  274. else
  275. {
  276. logNetwork->info("Sent leaving signal to the server");
  277. }
  278. sendLobbyPack(lcd);
  279. }
  280. void CServerHandler::setCampaignState(std::shared_ptr<CCampaignState> newCampaign)
  281. {
  282. state = EClientState::LOBBY_CAMPAIGN;
  283. LobbySetCampaign lsc;
  284. lsc.ourCampaign = newCampaign;
  285. sendLobbyPack(lsc);
  286. }
  287. void CServerHandler::setCampaignMap(int mapId) const
  288. {
  289. if(state == EClientState::GAMEPLAY) // FIXME: UI shouldn't sent commands in first place
  290. return;
  291. LobbySetCampaignMap lscm;
  292. lscm.mapId = mapId;
  293. sendLobbyPack(lscm);
  294. }
  295. void CServerHandler::setCampaignBonus(int bonusId) const
  296. {
  297. if(state == EClientState::GAMEPLAY) // FIXME: UI shouldn't sent commands in first place
  298. return;
  299. LobbySetCampaignBonus lscb;
  300. lscb.bonusId = bonusId;
  301. sendLobbyPack(lscb);
  302. }
  303. void CServerHandler::setMapInfo(std::shared_ptr<CMapInfo> to, std::shared_ptr<CMapGenOptions> mapGenOpts) const
  304. {
  305. LobbySetMap lsm;
  306. lsm.mapInfo = to;
  307. lsm.mapGenOpts = mapGenOpts;
  308. sendLobbyPack(lsm);
  309. }
  310. void CServerHandler::setPlayer(PlayerColor color) const
  311. {
  312. LobbySetPlayer lsp;
  313. lsp.clickedColor = color;
  314. sendLobbyPack(lsp);
  315. }
  316. void CServerHandler::setPlayerOption(ui8 what, ui8 dir, PlayerColor player) const
  317. {
  318. LobbyChangePlayerOption lcpo;
  319. lcpo.what = what;
  320. lcpo.direction = dir;
  321. lcpo.color = player;
  322. sendLobbyPack(lcpo);
  323. }
  324. void CServerHandler::setDifficulty(int to) const
  325. {
  326. LobbySetDifficulty lsd;
  327. lsd.difficulty = to;
  328. sendLobbyPack(lsd);
  329. }
  330. void CServerHandler::setTurnLength(int npos) const
  331. {
  332. vstd::amin(npos, GameConstants::POSSIBLE_TURNTIME.size() - 1);
  333. LobbySetTurnTime lstt;
  334. lstt.turnTime = GameConstants::POSSIBLE_TURNTIME[npos];
  335. sendLobbyPack(lstt);
  336. }
  337. void CServerHandler::sendMessage(const std::string & txt) const
  338. {
  339. std::istringstream readed;
  340. readed.str(txt);
  341. std::string command;
  342. readed >> command;
  343. if(command == "!passhost")
  344. {
  345. std::string id;
  346. readed >> id;
  347. if(id.length())
  348. {
  349. LobbyChangeHost lch;
  350. lch.newHostConnectionId = boost::lexical_cast<int>(id);
  351. sendLobbyPack(lch);
  352. }
  353. }
  354. else if(command == "!forcep")
  355. {
  356. std::string connectedId, playerColorId;
  357. readed >> connectedId;
  358. readed >> playerColorId;
  359. if(connectedId.length(), playerColorId.length())
  360. {
  361. ui8 connected = boost::lexical_cast<int>(connectedId);
  362. auto color = PlayerColor(boost::lexical_cast<int>(playerColorId));
  363. if(color.isValidPlayer() && playerNames.find(connected) != playerNames.end())
  364. {
  365. LobbyForceSetPlayer lfsp;
  366. lfsp.targetConnectedPlayer = connected;
  367. lfsp.targetPlayerColor = color;
  368. sendLobbyPack(lfsp);
  369. }
  370. }
  371. }
  372. else
  373. {
  374. LobbyChatMessage lcm;
  375. lcm.message = txt;
  376. lcm.playerName = playerNames.find(myFirstId())->second.name;
  377. sendLobbyPack(lcm);
  378. }
  379. }
  380. void CServerHandler::sendGuiAction(ui8 action) const
  381. {
  382. LobbyGuiAction lga;
  383. lga.action = static_cast<LobbyGuiAction::EAction>(action);
  384. sendLobbyPack(lga);
  385. }
  386. void CServerHandler::sendStartGame(bool allowOnlyAI) const
  387. {
  388. verifyStateBeforeStart(allowOnlyAI ? true : settings["session"]["onlyai"].Bool());
  389. LobbyStartGame lsg;
  390. sendLobbyPack(lsg);
  391. }
  392. void CServerHandler::startGameplay()
  393. {
  394. if(CMM)
  395. CMM->disable();
  396. client = new CClient();
  397. switch(si->mode)
  398. {
  399. case StartInfo::NEW_GAME:
  400. client->newGame();
  401. break;
  402. case StartInfo::CAMPAIGN:
  403. client->newGame();
  404. break;
  405. case StartInfo::LOAD_GAME:
  406. client->loadGame();
  407. break;
  408. default:
  409. throw std::runtime_error("Invalid mode");
  410. }
  411. // After everything initialized we can accept CPackToClient netpacks
  412. c->enterGameplayConnectionMode(client->gameState());
  413. state = EClientState::GAMEPLAY;
  414. }
  415. void CServerHandler::endGameplay(bool closeConnection)
  416. {
  417. client->endGame();
  418. vstd::clear_pointer(client);
  419. // Game is ending
  420. // Tell the network thread to reach a stable state
  421. CSH->sendClientDisconnecting();
  422. logNetwork->info("Closed connection.");
  423. if(CMM)
  424. {
  425. GH.curInt = CMM;
  426. CMM->enable();
  427. }
  428. else
  429. {
  430. GH.curInt = CMainMenu::create();
  431. }
  432. }
  433. void CServerHandler::startCampaignScenario(std::shared_ptr<CCampaignState> cs)
  434. {
  435. SDL_Event event;
  436. event.type = SDL_USEREVENT;
  437. event.user.code = EUserEvent::CAMPAIGN_START_SCENARIO;
  438. if(cs)
  439. event.user.data1 = CMemorySerializer::deepCopy(*cs.get()).release();
  440. else
  441. event.user.data1 = CMemorySerializer::deepCopy(*si->campState.get()).release();
  442. SDL_PushEvent(&event);
  443. }
  444. int CServerHandler::howManyPlayerInterfaces()
  445. {
  446. int playerInts = 0;
  447. for(auto pint : client->playerint)
  448. {
  449. if(dynamic_cast<CPlayerInterface *>(pint.second.get()))
  450. playerInts++;
  451. }
  452. return playerInts;
  453. }
  454. ui8 CServerHandler::getLoadMode()
  455. {
  456. if(state == EClientState::GAMEPLAY)
  457. {
  458. if(si->campState)
  459. return ELoadMode::CAMPAIGN;
  460. for(auto pn : playerNames)
  461. {
  462. if(pn.second.connection != c->connectionID)
  463. return ELoadMode::MULTI;
  464. }
  465. return ELoadMode::SINGLE;
  466. }
  467. return loadMode;
  468. }
  469. void CServerHandler::debugStartTest(std::string filename, bool save)
  470. {
  471. logGlobal->info("Starting debug test with file: %s", filename);
  472. auto mapInfo = std::make_shared<CMapInfo>();
  473. if(save)
  474. {
  475. resetStateForLobby(StartInfo::LOAD_GAME);
  476. mapInfo->saveInit(ResourceID(filename, EResType::CLIENT_SAVEGAME));
  477. screenType = ESelectionScreen::loadGame;
  478. }
  479. else
  480. {
  481. resetStateForLobby(StartInfo::NEW_GAME);
  482. mapInfo->mapInit(filename);
  483. screenType = ESelectionScreen::newGame;
  484. }
  485. if(settings["session"]["donotstartserver"].Bool())
  486. justConnectToServer("127.0.0.1", 3030);
  487. else
  488. startLocalServerAndConnect();
  489. while(!settings["session"]["headless"].Bool() && !dynamic_cast<CLobbyScreen *>(GH.topInt()))
  490. boost::this_thread::sleep(boost::posix_time::milliseconds(50));
  491. while(!mi || mapInfo->fileURI != CSH->mi->fileURI)
  492. {
  493. setMapInfo(mapInfo);
  494. boost::this_thread::sleep(boost::posix_time::milliseconds(50));
  495. }
  496. // "Click" on color to remove us from it
  497. setPlayer(myFirstColor());
  498. while(myFirstColor() != PlayerColor::CANNOT_DETERMINE)
  499. boost::this_thread::sleep(boost::posix_time::milliseconds(50));
  500. while(true)
  501. {
  502. try
  503. {
  504. sendStartGame();
  505. break;
  506. }
  507. catch(...)
  508. {
  509. }
  510. boost::this_thread::sleep(boost::posix_time::milliseconds(50));
  511. }
  512. }
  513. void CServerHandler::threadHandleConnection()
  514. {
  515. setThreadName("CServerHandler::threadHandleConnection");
  516. c->enterLobbyConnectionMode();
  517. try
  518. {
  519. sendClientConnecting();
  520. while(c->connected)
  521. {
  522. while(state == EClientState::STARTING)
  523. boost::this_thread::sleep(boost::posix_time::milliseconds(10));
  524. CPack * pack = c->retrievePack();
  525. if(state == EClientState::DISCONNECTING)
  526. {
  527. // FIXME: server shouldn't really send netpacks after it's tells client to disconnect
  528. // Though currently they'll be delivered and might cause crash.
  529. vstd::clear_pointer(pack);
  530. }
  531. else if(auto lobbyPack = dynamic_cast<CPackForLobby *>(pack))
  532. {
  533. if(applier->getApplier(typeList.getTypeID(pack))->applyOnLobbyHandler(this, pack))
  534. {
  535. if(!settings["session"]["headless"].Bool())
  536. {
  537. boost::unique_lock<boost::recursive_mutex> lock(*mx);
  538. packsForLobbyScreen.push_back(lobbyPack);
  539. }
  540. }
  541. }
  542. else if(auto clientPack = dynamic_cast<CPackForClient *>(pack))
  543. {
  544. client->handlePack(clientPack);
  545. }
  546. }
  547. }
  548. //catch only asio exceptions
  549. catch(const boost::system::system_error & e)
  550. {
  551. if(state == EClientState::DISCONNECTING)
  552. {
  553. logNetwork->info("Successfully closed connection to server, ending listening thread!");
  554. }
  555. else
  556. {
  557. logNetwork->error("Lost connection to server, ending listening thread!");
  558. logNetwork->error(e.what());
  559. if(client)
  560. {
  561. CGuiHandler::pushSDLEvent(SDL_USEREVENT, EUserEvent::RETURN_TO_MAIN_MENU);
  562. }
  563. else
  564. {
  565. auto lcd = new LobbyClientDisconnected();
  566. lcd->clientId = c->connectionID;
  567. boost::unique_lock<boost::recursive_mutex> lock(*mx);
  568. packsForLobbyScreen.push_back(lcd);
  569. }
  570. }
  571. }
  572. catch(...)
  573. {
  574. handleException();
  575. throw;
  576. }
  577. }
  578. void CServerHandler::threadRunServer()
  579. {
  580. #ifndef VCMI_ANDROID
  581. setThreadName("CServerHandler::threadRunServer");
  582. const std::string logName = (VCMIDirs::get().userCachePath() / "server_log.txt").string();
  583. std::string comm = VCMIDirs::get().serverPath().string()
  584. + " --port=" + getDefaultPortStr()
  585. + " --run-by-client"
  586. + " --uuid=" + uuid;
  587. if(shm)
  588. {
  589. comm += " --enable-shm";
  590. if(settings["session"]["enable-shm-uuid"].Bool())
  591. comm += " --enable-shm-uuid";
  592. }
  593. comm += " > \"" + logName + '\"';
  594. int result = std::system(comm.c_str());
  595. if (result == 0)
  596. {
  597. logNetwork->info("Server closed correctly");
  598. }
  599. else
  600. {
  601. logNetwork->error("Error: server failed to close correctly or crashed!");
  602. logNetwork->error("Check %s for more info", logName);
  603. }
  604. threadRunLocalServer.reset();
  605. #endif
  606. }
  607. void CServerHandler::sendLobbyPack(const CPackForLobby & pack) const
  608. {
  609. if(state != EClientState::STARTING)
  610. c->sendPack(&pack);
  611. }