diff --git a/main.cpp b/main.cpp index 8f0401d..9aa4382 100755 --- a/main.cpp +++ b/main.cpp @@ -5,6 +5,7 @@ int main(int, char **) { auto config = std::make_shared(); auto server = std::make_shared(config); + server->createRooms(config->group("rooms")); server->run(); return 0; } diff --git a/server.cpp b/server.cpp index 84705db..512210f 100755 --- a/server.cpp +++ b/server.cpp @@ -31,7 +31,7 @@ namespace Yc { std::cout << "bind not possible" << std::endl; exit(-1); } - createRooms(_config->group("rooms")); + // createRooms wird jetzt außerhalb des Konstruktors aufgerufen } void Server::run() { diff --git a/server.h b/server.h index c4624e6..34b5d50 100755 --- a/server.h +++ b/server.h @@ -19,12 +19,13 @@ namespace Yc { Json::Value jsonRoomList(); bool roomAllowed(std::string roomName, std::string userName, std::string password); bool changeRoom(std::shared_ptr user, std::string newRoom, std::string password); - private: + public: int _socket; std::shared_ptr _config; bool _stop; std::vector> _rooms; void createRooms(Json::Value roomList); + private: void handleRequest(); void inputSwitcher(int userSocket, std::string input); bool userExists(std::string userName);