add HTTP server

This commit is contained in:
Martin Michelsen
2024-02-18 21:33:15 -08:00
parent bd13950ba6
commit f16b8ef983
21 changed files with 1290 additions and 266 deletions
+6 -3
View File
@@ -843,7 +843,7 @@ void ProxyServer::LinkedSession::on_input(Channel& ch, uint16_t command, uint32_
}
}
shared_ptr<ProxyServer::LinkedSession> ProxyServer::get_session() {
shared_ptr<ProxyServer::LinkedSession> ProxyServer::get_session() const {
if (this->id_to_session.empty()) {
throw runtime_error("no sessions exist");
}
@@ -853,8 +853,7 @@ 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) {
shared_ptr<ProxyServer::LinkedSession> ProxyServer::get_session_by_name(const std::string& name) const {
try {
uint64_t session_id = stoull(name, nullptr, 16);
return this->id_to_session.at(session_id);
@@ -865,6 +864,10 @@ shared_ptr<ProxyServer::LinkedSession> ProxyServer::get_session_by_name(
}
}
const unordered_map<uint64_t, shared_ptr<ProxyServer::LinkedSession>>& ProxyServer::all_sessions() const {
return this->id_to_session;
}
shared_ptr<ProxyServer::LinkedSession> ProxyServer::create_licensed_session(
shared_ptr<License> l,
uint16_t local_port,