LobbyServer.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /*
  2. * LobbyServer.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 "LobbyServer.h"
  12. #include "LobbyDatabase.h"
  13. #include "../lib/json/JsonFormatException.h"
  14. #include "../lib/json/JsonNode.h"
  15. #include "../lib/json/JsonUtils.h"
  16. #include <boost/uuid/uuid_generators.hpp>
  17. #include <boost/uuid/uuid_io.hpp>
  18. bool LobbyServer::isAccountNameValid(const std::string & accountName) const
  19. {
  20. if(accountName.size() < 4)
  21. return false;
  22. if(accountName.size() > 20)
  23. return false;
  24. for(const auto & c : accountName)
  25. if(!std::isalnum(c))
  26. return false;
  27. return true;
  28. }
  29. std::string LobbyServer::sanitizeChatMessage(const std::string & inputString) const
  30. {
  31. // TODO: sanitize message and remove any "weird" symbols from it
  32. return inputString;
  33. }
  34. NetworkConnectionPtr LobbyServer::findAccount(const std::string & accountID) const
  35. {
  36. for(const auto & account : activeAccounts)
  37. if(account.second == accountID)
  38. return account.first;
  39. return nullptr;
  40. }
  41. NetworkConnectionPtr LobbyServer::findGameRoom(const std::string & gameRoomID) const
  42. {
  43. for(const auto & account : activeGameRooms)
  44. if(account.second == gameRoomID)
  45. return account.first;
  46. return nullptr;
  47. }
  48. void LobbyServer::sendMessage(const NetworkConnectionPtr & target, const JsonNode & json)
  49. {
  50. assert(JsonUtils::validate(json, "vcmi:lobbyProtocol/" + json["type"].String(), json["type"].String() + " pack"));
  51. target->sendPacket(json.toBytes());
  52. }
  53. void LobbyServer::sendAccountCreated(const NetworkConnectionPtr & target, const std::string & accountID, const std::string & accountCookie)
  54. {
  55. JsonNode reply;
  56. reply["type"].String() = "accountCreated";
  57. reply["accountID"].String() = accountID;
  58. reply["accountCookie"].String() = accountCookie;
  59. sendMessage(target, reply);
  60. }
  61. void LobbyServer::sendInviteReceived(const NetworkConnectionPtr & target, const std::string & accountID, const std::string & gameRoomID)
  62. {
  63. JsonNode reply;
  64. reply["type"].String() = "inviteReceived";
  65. reply["accountID"].String() = accountID;
  66. reply["gameRoomID"].String() = gameRoomID;
  67. sendMessage(target, reply);
  68. }
  69. void LobbyServer::sendOperationFailed(const NetworkConnectionPtr & target, const std::string & reason)
  70. {
  71. JsonNode reply;
  72. reply["type"].String() = "operationFailed";
  73. reply["reason"].String() = reason;
  74. sendMessage(target, reply);
  75. }
  76. void LobbyServer::sendLoginSuccess(const NetworkConnectionPtr & target, const std::string & accountCookie, const std::string & displayName)
  77. {
  78. JsonNode reply;
  79. reply["type"].String() = "loginSuccess";
  80. reply["accountCookie"].String() = accountCookie;
  81. if(!displayName.empty())
  82. reply["displayName"].String() = displayName;
  83. sendMessage(target, reply);
  84. }
  85. void LobbyServer::sendChatHistory(const NetworkConnectionPtr & target, const std::vector<LobbyChatMessage> & history)
  86. {
  87. JsonNode reply;
  88. reply["type"].String() = "chatHistory";
  89. reply["messages"].Vector(); // force creation of empty vector
  90. for(const auto & message : boost::adaptors::reverse(history))
  91. {
  92. JsonNode jsonEntry;
  93. jsonEntry["accountID"].String() = message.accountID;
  94. jsonEntry["displayName"].String() = message.displayName;
  95. jsonEntry["messageText"].String() = message.messageText;
  96. jsonEntry["ageSeconds"].Integer() = message.age.count();
  97. reply["messages"].Vector().push_back(jsonEntry);
  98. }
  99. sendMessage(target, reply);
  100. }
  101. void LobbyServer::broadcastActiveAccounts()
  102. {
  103. auto activeAccountsStats = database->getActiveAccounts();
  104. JsonNode reply;
  105. reply["type"].String() = "activeAccounts";
  106. reply["accounts"].Vector(); // force creation of empty vector
  107. for(const auto & account : activeAccountsStats)
  108. {
  109. JsonNode jsonEntry;
  110. jsonEntry["accountID"].String() = account.accountID;
  111. jsonEntry["displayName"].String() = account.displayName;
  112. jsonEntry["status"].String() = "In Lobby"; // TODO: in room status, in match status, offline status(?)
  113. reply["accounts"].Vector().push_back(jsonEntry);
  114. }
  115. for(const auto & connection : activeAccounts)
  116. sendMessage(connection.first, reply);
  117. }
  118. JsonNode LobbyServer::prepareActiveGameRooms()
  119. {
  120. auto activeGameRoomStats = database->getActiveGameRooms();
  121. JsonNode reply;
  122. reply["type"].String() = "activeGameRooms";
  123. reply["gameRooms"].Vector(); // force creation of empty vector
  124. for(const auto & gameRoom : activeGameRoomStats)
  125. {
  126. JsonNode jsonEntry;
  127. jsonEntry["gameRoomID"].String() = gameRoom.roomID;
  128. jsonEntry["hostAccountID"].String() = gameRoom.hostAccountID;
  129. jsonEntry["hostAccountDisplayName"].String() = gameRoom.hostAccountDisplayName;
  130. jsonEntry["description"].String() = "TODO: ROOM DESCRIPTION";
  131. jsonEntry["playersCount"].Integer() = gameRoom.playersCount;
  132. jsonEntry["playersLimit"].Integer() = gameRoom.playersLimit;
  133. reply["gameRooms"].Vector().push_back(jsonEntry);
  134. }
  135. return reply;
  136. }
  137. void LobbyServer::broadcastActiveGameRooms()
  138. {
  139. auto reply = prepareActiveGameRooms();
  140. for(const auto & connection : activeAccounts)
  141. sendMessage(connection.first, reply);
  142. }
  143. void LobbyServer::sendAccountJoinsRoom(const NetworkConnectionPtr & target, const std::string & accountID)
  144. {
  145. JsonNode reply;
  146. reply["type"].String() = "accountJoinsRoom";
  147. reply["accountID"].String() = accountID;
  148. sendMessage(target, reply);
  149. }
  150. void LobbyServer::sendJoinRoomSuccess(const NetworkConnectionPtr & target, const std::string & gameRoomID, bool proxyMode)
  151. {
  152. JsonNode reply;
  153. reply["type"].String() = "joinRoomSuccess";
  154. reply["gameRoomID"].String() = gameRoomID;
  155. reply["proxyMode"].Bool() = proxyMode;
  156. sendMessage(target, reply);
  157. }
  158. void LobbyServer::sendChatMessage(const NetworkConnectionPtr & target, const std::string & roomMode, const std::string & roomName, const std::string & accountID, const std::string & displayName, const std::string & messageText)
  159. {
  160. JsonNode reply;
  161. reply["type"].String() = "chatMessage";
  162. reply["messageText"].String() = messageText;
  163. reply["accountID"].String() = accountID;
  164. reply["displayName"].String() = displayName;
  165. reply["roomMode"].String() = roomMode;
  166. reply["roomName"].String() = roomName;
  167. sendMessage(target, reply);
  168. }
  169. void LobbyServer::onNewConnection(const NetworkConnectionPtr & connection)
  170. {
  171. // no-op - waiting for incoming data
  172. }
  173. void LobbyServer::onDisconnected(const NetworkConnectionPtr & connection, const std::string & errorMessage)
  174. {
  175. if(activeAccounts.count(connection))
  176. {
  177. database->setAccountOnline(activeAccounts.at(connection), false);
  178. activeAccounts.erase(connection);
  179. }
  180. if(activeGameRooms.count(connection))
  181. {
  182. database->setGameRoomStatus(activeGameRooms.at(connection), LobbyRoomState::CLOSED);
  183. activeGameRooms.erase(connection);
  184. }
  185. if(activeProxies.count(connection))
  186. {
  187. const auto & otherConnection = activeProxies.at(connection);
  188. if (otherConnection)
  189. otherConnection->close();
  190. activeProxies.erase(connection);
  191. activeProxies.erase(otherConnection);
  192. }
  193. broadcastActiveAccounts();
  194. broadcastActiveGameRooms();
  195. }
  196. JsonNode LobbyServer::parseAndValidateMessage(const std::vector<std::byte> & message) const
  197. {
  198. JsonParsingSettings parserSettings;
  199. parserSettings.mode = JsonParsingSettings::JsonFormatMode::JSON;
  200. parserSettings.maxDepth = 2;
  201. parserSettings.strict = true;
  202. JsonNode json;
  203. try
  204. {
  205. JsonNode jsonTemp(message.data(), message.size());
  206. json = std::move(jsonTemp);
  207. }
  208. catch (const JsonFormatException & e)
  209. {
  210. logGlobal->info(std::string("Json parsing error encountered: ") + e.what());
  211. return JsonNode();
  212. }
  213. std::string messageType = json["type"].String();
  214. if (messageType.empty())
  215. {
  216. logGlobal->info("Json parsing error encountered: Message type not set!");
  217. return JsonNode();
  218. }
  219. std::string schemaName = "vcmi:lobbyProtocol/" + messageType;
  220. if (!JsonUtils::validate(json, schemaName, messageType + " pack"))
  221. {
  222. logGlobal->info("Json validation error encountered!");
  223. assert(0);
  224. return JsonNode();
  225. }
  226. return json;
  227. }
  228. void LobbyServer::onPacketReceived(const NetworkConnectionPtr & connection, const std::vector<std::byte> & message)
  229. {
  230. // proxy connection - no processing, only redirect
  231. if(activeProxies.count(connection))
  232. {
  233. auto lockedPtr = activeProxies.at(connection);
  234. if(lockedPtr)
  235. return lockedPtr->sendPacket(message);
  236. logGlobal->info("Received unexpected message for inactive proxy!");
  237. }
  238. JsonNode json = parseAndValidateMessage(message);
  239. std::string messageType = json["type"].String();
  240. // communication messages from vcmiclient
  241. if(activeAccounts.count(connection))
  242. {
  243. std::string accountName = activeAccounts.at(connection);
  244. logGlobal->info("%s: Received message of type %s", accountName, messageType);
  245. if(messageType == "sendChatMessage")
  246. return receiveSendChatMessage(connection, json);
  247. if(messageType == "activateGameRoom")
  248. return receiveActivateGameRoom(connection, json);
  249. if(messageType == "joinGameRoom")
  250. return receiveJoinGameRoom(connection, json);
  251. if(messageType == "sendInvite")
  252. return receiveSendInvite(connection, json);
  253. if(messageType == "declineInvite")
  254. return receiveDeclineInvite(connection, json);
  255. logGlobal->warn("%s: Unknown message type: %s", accountName, messageType);
  256. return;
  257. }
  258. // communication messages from vcmiserver
  259. if(activeGameRooms.count(connection))
  260. {
  261. std::string roomName = activeGameRooms.at(connection);
  262. logGlobal->info("%s: Received message of type %s", roomName, messageType);
  263. if(messageType == "leaveGameRoom")
  264. return receiveLeaveGameRoom(connection, json);
  265. logGlobal->warn("%s: Unknown message type: %s", roomName, messageType);
  266. return;
  267. }
  268. logGlobal->info("(unauthorised): Received message of type %s", messageType);
  269. // unauthorized connections - permit only login or register attempts
  270. if(messageType == "clientLogin")
  271. return receiveClientLogin(connection, json);
  272. if(messageType == "clientRegister")
  273. return receiveClientRegister(connection, json);
  274. if(messageType == "serverLogin")
  275. return receiveServerLogin(connection, json);
  276. if(messageType == "clientProxyLogin")
  277. return receiveClientProxyLogin(connection, json);
  278. if(messageType == "serverProxyLogin")
  279. return receiveServerProxyLogin(connection, json);
  280. connection->close();
  281. logGlobal->info("(unauthorised): Unknown message type %s", messageType);
  282. }
  283. void LobbyServer::receiveSendChatMessage(const NetworkConnectionPtr & connection, const JsonNode & json)
  284. {
  285. std::string accountID = activeAccounts[connection];
  286. std::string messageText = json["messageText"].String();
  287. std::string messageTextClean = sanitizeChatMessage(messageText);
  288. std::string displayName = database->getAccountDisplayName(accountID);
  289. if(messageTextClean.empty())
  290. return sendOperationFailed(connection, "No printable characters in sent message!");
  291. database->insertChatMessage(accountID, "global", "english", messageText);
  292. for(const auto & otherConnection : activeAccounts)
  293. sendChatMessage(otherConnection.first, "global", "english", accountID, displayName, messageText);
  294. }
  295. void LobbyServer::receiveClientRegister(const NetworkConnectionPtr & connection, const JsonNode & json)
  296. {
  297. std::string displayName = json["displayName"].String();
  298. std::string language = json["language"].String();
  299. if(!isAccountNameValid(displayName))
  300. return sendOperationFailed(connection, "Illegal account name");
  301. if(database->isAccountNameExists(displayName))
  302. return sendOperationFailed(connection, "Account name already in use");
  303. std::string accountCookie = boost::uuids::to_string(boost::uuids::random_generator()());
  304. std::string accountID = boost::uuids::to_string(boost::uuids::random_generator()());
  305. database->insertAccount(accountID, displayName);
  306. database->insertAccessCookie(accountID, accountCookie);
  307. sendAccountCreated(connection, accountID, accountCookie);
  308. }
  309. void LobbyServer::receiveClientLogin(const NetworkConnectionPtr & connection, const JsonNode & json)
  310. {
  311. std::string accountID = json["accountID"].String();
  312. std::string accountCookie = json["accountCookie"].String();
  313. std::string language = json["language"].String();
  314. std::string version = json["version"].String();
  315. if(!database->isAccountIDExists(accountID))
  316. return sendOperationFailed(connection, "Account not found");
  317. auto clientCookieStatus = database->getAccountCookieStatus(accountID, accountCookie);
  318. if(clientCookieStatus == LobbyCookieStatus::INVALID)
  319. return sendOperationFailed(connection, "Authentification failure");
  320. database->updateAccountLoginTime(accountID);
  321. database->setAccountOnline(accountID, true);
  322. std::string displayName = database->getAccountDisplayName(accountID);
  323. activeAccounts[connection] = accountID;
  324. sendLoginSuccess(connection, accountCookie, displayName);
  325. sendChatHistory(connection, database->getRecentMessageHistory());
  326. // send active game rooms list to new account
  327. // and update acount list to everybody else including new account
  328. broadcastActiveAccounts();
  329. sendMessage(connection, prepareActiveGameRooms());
  330. }
  331. void LobbyServer::receiveServerLogin(const NetworkConnectionPtr & connection, const JsonNode & json)
  332. {
  333. std::string gameRoomID = json["gameRoomID"].String();
  334. std::string accountID = json["accountID"].String();
  335. std::string accountCookie = json["accountCookie"].String();
  336. std::string version = json["version"].String();
  337. auto clientCookieStatus = database->getAccountCookieStatus(accountID, accountCookie);
  338. if(clientCookieStatus == LobbyCookieStatus::INVALID)
  339. {
  340. sendOperationFailed(connection, "Invalid credentials");
  341. }
  342. else
  343. {
  344. database->insertGameRoom(gameRoomID, accountID);
  345. activeGameRooms[connection] = gameRoomID;
  346. sendLoginSuccess(connection, accountCookie, {});
  347. broadcastActiveGameRooms();
  348. }
  349. }
  350. void LobbyServer::receiveClientProxyLogin(const NetworkConnectionPtr & connection, const JsonNode & json)
  351. {
  352. std::string gameRoomID = json["gameRoomID"].String();
  353. std::string accountID = json["accountID"].String();
  354. std::string accountCookie = json["accountCookie"].String();
  355. auto clientCookieStatus = database->getAccountCookieStatus(accountID, accountCookie);
  356. if(clientCookieStatus != LobbyCookieStatus::INVALID)
  357. {
  358. for(auto & proxyEntry : awaitingProxies)
  359. {
  360. if(proxyEntry.accountID != accountID)
  361. continue;
  362. if(proxyEntry.roomID != gameRoomID)
  363. continue;
  364. proxyEntry.accountConnection = connection;
  365. auto gameRoomConnection = proxyEntry.roomConnection.lock();
  366. if(gameRoomConnection)
  367. {
  368. activeProxies[gameRoomConnection] = connection;
  369. activeProxies[connection] = gameRoomConnection;
  370. }
  371. return;
  372. }
  373. }
  374. sendOperationFailed(connection, "Invalid credentials");
  375. connection->close();
  376. }
  377. void LobbyServer::receiveServerProxyLogin(const NetworkConnectionPtr & connection, const JsonNode & json)
  378. {
  379. std::string gameRoomID = json["gameRoomID"].String();
  380. std::string guestAccountID = json["guestAccountID"].String();
  381. std::string accountCookie = json["accountCookie"].String();
  382. // FIXME: find host account ID and validate his cookie
  383. //auto clientCookieStatus = database->getAccountCookieStatus(hostAccountID, accountCookie, accountCookieLifetime);
  384. //if(clientCookieStatus != LobbyCookieStatus::INVALID)
  385. {
  386. NetworkConnectionPtr targetAccount = findAccount(guestAccountID);
  387. if(targetAccount == nullptr)
  388. {
  389. sendOperationFailed(connection, "Invalid credentials");
  390. return; // unknown / disconnected account
  391. }
  392. sendJoinRoomSuccess(targetAccount, gameRoomID, true);
  393. AwaitingProxyState proxy;
  394. proxy.accountID = guestAccountID;
  395. proxy.roomID = gameRoomID;
  396. proxy.roomConnection = connection;
  397. awaitingProxies.push_back(proxy);
  398. return;
  399. }
  400. //connection->close();
  401. }
  402. void LobbyServer::receiveActivateGameRoom(const NetworkConnectionPtr & connection, const JsonNode & json)
  403. {
  404. std::string hostAccountID = json["hostAccountID"].String();
  405. std::string accountID = activeAccounts[connection];
  406. if(database->isPlayerInGameRoom(accountID))
  407. return sendOperationFailed(connection, "Player already in the room!");
  408. std::string gameRoomID = database->getIdleGameRoom(hostAccountID);
  409. if(gameRoomID.empty())
  410. return sendOperationFailed(connection, "Failed to find idle server to join!");
  411. std::string roomType = json["roomType"].String();
  412. if(roomType != "public" && roomType != "private")
  413. return sendOperationFailed(connection, "Invalid room type!");
  414. if(roomType == "public")
  415. database->setGameRoomStatus(gameRoomID, LobbyRoomState::PUBLIC);
  416. if(roomType == "private")
  417. database->setGameRoomStatus(gameRoomID, LobbyRoomState::PRIVATE);
  418. database->insertPlayerIntoGameRoom(accountID, gameRoomID);
  419. broadcastActiveGameRooms();
  420. sendJoinRoomSuccess(connection, gameRoomID, false);
  421. }
  422. void LobbyServer::receiveJoinGameRoom(const NetworkConnectionPtr & connection, const JsonNode & json)
  423. {
  424. std::string gameRoomID = json["gameRoomID"].String();
  425. std::string accountID = activeAccounts[connection];
  426. if(database->isPlayerInGameRoom(accountID))
  427. return sendOperationFailed(connection, "Player already in the room!");
  428. NetworkConnectionPtr targetRoom = findGameRoom(gameRoomID);
  429. if(targetRoom == nullptr)
  430. return sendOperationFailed(connection, "Failed to find game room to join!");
  431. auto roomStatus = database->getGameRoomStatus(gameRoomID);
  432. if(roomStatus != LobbyRoomState::PRIVATE && roomStatus != LobbyRoomState::PUBLIC)
  433. return sendOperationFailed(connection, "Room does not accepts new players!");
  434. if(roomStatus == LobbyRoomState::PRIVATE)
  435. {
  436. if(database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::INVITED)
  437. return sendOperationFailed(connection, "You are not permitted to join private room without invite!");
  438. }
  439. if(database->getGameRoomFreeSlots(gameRoomID) == 0)
  440. return sendOperationFailed(connection, "Room is already full!");
  441. database->insertPlayerIntoGameRoom(accountID, gameRoomID);
  442. sendAccountJoinsRoom(targetRoom, accountID);
  443. //No reply to client - will be sent once match server establishes proxy connection with lobby
  444. broadcastActiveGameRooms();
  445. }
  446. void LobbyServer::receiveLeaveGameRoom(const NetworkConnectionPtr & connection, const JsonNode & json)
  447. {
  448. std::string accountID = json["accountID"].String();
  449. std::string gameRoomID = activeGameRooms[connection];
  450. if(!database->isPlayerInGameRoom(accountID, gameRoomID))
  451. return sendOperationFailed(connection, "You are not in the room!");
  452. database->deletePlayerFromGameRoom(accountID, gameRoomID);
  453. broadcastActiveGameRooms();
  454. }
  455. void LobbyServer::receiveSendInvite(const NetworkConnectionPtr & connection, const JsonNode & json)
  456. {
  457. std::string senderName = activeAccounts[connection];
  458. std::string accountID = json["accountID"].String();
  459. std::string gameRoomID = database->getAccountGameRoom(senderName);
  460. auto targetAccount = findAccount(accountID);
  461. if(!targetAccount)
  462. return sendOperationFailed(connection, "Invalid account to invite!");
  463. if(!database->isPlayerInGameRoom(senderName))
  464. return sendOperationFailed(connection, "You are not in the room!");
  465. if(database->isPlayerInGameRoom(accountID))
  466. return sendOperationFailed(connection, "This player is already in a room!");
  467. if(database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::NOT_INVITED)
  468. return sendOperationFailed(connection, "This player is already invited!");
  469. database->insertGameRoomInvite(accountID, gameRoomID);
  470. sendInviteReceived(targetAccount, senderName, gameRoomID);
  471. }
  472. void LobbyServer::receiveDeclineInvite(const NetworkConnectionPtr & connection, const JsonNode & json)
  473. {
  474. std::string accountID = activeAccounts[connection];
  475. std::string gameRoomID = json["gameRoomID"].String();
  476. if(database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::INVITED)
  477. return sendOperationFailed(connection, "No active invite found!");
  478. database->deleteGameRoomInvite(accountID, gameRoomID);
  479. }
  480. LobbyServer::~LobbyServer() = default;
  481. LobbyServer::LobbyServer(const boost::filesystem::path & databasePath)
  482. : database(std::make_unique<LobbyDatabase>(databasePath))
  483. , networkHandler(INetworkHandler::createHandler())
  484. , networkServer(networkHandler->createServerTCP(*this))
  485. {
  486. }
  487. void LobbyServer::start(uint16_t port)
  488. {
  489. networkServer->start(port);
  490. }
  491. void LobbyServer::run()
  492. {
  493. networkHandler->run();
  494. }