add playing state

This commit is contained in:
Lion Kortlepel 2024-01-26 12:25:40 +01:00
parent 4dad60bc52
commit 6a7bf72df5
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B
2 changed files with 13 additions and 1 deletions

View File

@ -77,6 +77,7 @@ void ServerNetwork::handle_packet(const bmp::Packet& packet) {
handle_session_setup(packet);
break;
case bmp::State::Playing:
handle_playing(packet);
break;
case bmp::State::Leaving:
break;
@ -274,7 +275,7 @@ void ServerNetwork::handle_session_setup(const bmp::Packet& packet) {
break;
}
case bmp::Purpose::StateChangePlaying: {
spdlog::debug("Playing!");
spdlog::info("Playing!");
break;
}
default:
@ -283,3 +284,13 @@ void ServerNetwork::handle_session_setup(const bmp::Packet& packet) {
break;
}
}
void ServerNetwork::handle_playing(const bmp::Packet& packet) {
switch (packet.purpose) {
default:
spdlog::error("Got 0x{:x} in state {}. This is not allowed. Disconnecting", uint16_t(packet.purpose), int(m_state));
// todo: disconnect gracefully
break;
}
}

View File

@ -34,6 +34,7 @@ private:
void handle_authentication(const bmp::Packet& packet);
void handle_mod_download(const bmp::Packet& packet);
void handle_session_setup(const bmp::Packet& packet);
void handle_playing(const bmp::Packet& packet);
io_context m_io {};
ip::tcp::socket m_tcp_socket { m_io };