enable most shell commands to affect a specific session

This commit is contained in:
Martin Michelsen
2022-12-26 21:33:38 -08:00
parent de7239e3fb
commit dfad80eb9a
6 changed files with 129 additions and 23 deletions
+12
View File
@@ -795,6 +795,18 @@ shared_ptr<ProxyServer::LinkedSession> ProxyServer::get_session() {
return this->id_to_session.begin()->second;
}
shared_ptr<ProxyServer::LinkedSession> ProxyServer::get_session_by_name(
const std::string& name) {
try {
uint64_t session_id = stoull(name, nullptr, 16);
return this->id_to_session.at(session_id);
} catch (const invalid_argument&) {
throw runtime_error("invalid session name");
} catch (const out_of_range&) {
throw runtime_error("no such session");
}
}
shared_ptr<ProxyServer::LinkedSession> ProxyServer::create_licensed_session(
shared_ptr<const License> l, uint16_t local_port, GameVersion version,
const ClientConfigBB& newserv_client_config) {