TOSAsync
This commit is contained in:
@@ -247,7 +247,7 @@ coro<> GameServer::pushSocketGameProtocol(tcp::socket socket, const std::string
|
||||
co_await Net::AsyncSocket::write<uint8_t>(socket, 0);
|
||||
|
||||
External.NewConnectedPlayers.lock_write()
|
||||
->push_back(std::make_unique<RemoteClient>(IOC, std::move(socket), username));
|
||||
->push_back(RemoteClient::Create(IOC, std::move(socket), username));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ void GameServer::run() {
|
||||
// Отключить вновь подключившихся
|
||||
auto lock = External.NewConnectedPlayers.lock_write();
|
||||
|
||||
for(std::unique_ptr<RemoteClient> &client : *lock) {
|
||||
for(RemoteClient_ptr &client : *lock) {
|
||||
client->shutdown(EnumDisconnect::ByInterface, ShutdownReason);
|
||||
}
|
||||
|
||||
@@ -449,8 +449,7 @@ void GameServer::stepPlayers() {
|
||||
if(!External.NewConnectedPlayers.no_lock_readable().empty()) {
|
||||
auto lock = External.NewConnectedPlayers.lock_write();
|
||||
|
||||
for(std::unique_ptr<RemoteClient> &client : *lock) {
|
||||
asio::co_spawn(IOC, client->run(), asio::detached);
|
||||
for(RemoteClient_ptr &client : *lock) {
|
||||
Game.CECs.push_back(std::make_unique<ContentEventController>(std::move(client)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user