Reserve 1 channel for game replay transfer

This commit is contained in:
Benau
2019-03-14 10:39:01 +08:00
parent b3ca809da4
commit 8446ce9a5c
2 changed files with 4 additions and 2 deletions

View File

@@ -75,7 +75,8 @@ Event::Event(ENetEvent* event, std::shared_ptr<STKPeer> peer)
{
throw std::runtime_error("Unencrypted content at wrong state.");
}
if (m_peer->getCrypto() && event->channelID == EVENT_CHANNEL_NORMAL)
if (m_peer->getCrypto() && (event->channelID == EVENT_CHANNEL_NORMAL ||
event->channelID == EVENT_CHANNEL_DATA_TRANSFER))
{
m_data = m_peer->getCrypto()->decryptRecieve(event->packet);
}

View File

@@ -53,7 +53,8 @@ enum EVENT_CHANNEL : uint8_t
{
EVENT_CHANNEL_NORMAL = 0, //!< Normal channel (encrypted if supported)
EVENT_CHANNEL_UNENCRYPTED = 1,//!< Unencrypted channel
EVENT_CHANNEL_COUNT = 2
EVENT_CHANNEL_DATA_TRANSFER = 2,//!< Data transfer channel (like game replay)
EVENT_CHANNEL_COUNT = 3
};
enum PeerDisconnectInfo : unsigned int;