1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Add session_t typedef + remove unused functions (#6470)

* Add session_t typedef + remove unused functions

u16 peer_id is used everywhere, to be more consistent and permit some evolutions on this type in the future (i'm working on a PoC), uniformize u16 peer_id to SessionId peer_id
This commit is contained in:
Loïc Blot 2017-09-27 19:47:36 +02:00 committed by GitHub
parent 50b2185ced
commit ad7daf7b52
24 changed files with 294 additions and 283 deletions

View file

@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <cassert>
#include "util/basic_macros.h"
bool ModChannel::registerConsumer(u16 peer_id)
bool ModChannel::registerConsumer(session_t peer_id)
{
// ignore if peer_id already joined
@ -33,7 +33,7 @@ bool ModChannel::registerConsumer(u16 peer_id)
return true;
}
bool ModChannel::removeConsumer(u16 peer_id)
bool ModChannel::removeConsumer(session_t peer_id)
{
bool found = false;
auto peer_removal_fct = [peer_id, &found](u16 p) {
@ -112,7 +112,7 @@ bool ModChannelMgr::removeChannel(const std::string &channel)
return true;
}
bool ModChannelMgr::joinChannel(const std::string &channel, u16 peer_id)
bool ModChannelMgr::joinChannel(const std::string &channel, session_t peer_id)
{
if (!channelRegistered(channel))
registerChannel(channel);
@ -120,7 +120,7 @@ bool ModChannelMgr::joinChannel(const std::string &channel, u16 peer_id)
return m_registered_channels[channel]->registerConsumer(peer_id);
}
bool ModChannelMgr::leaveChannel(const std::string &channel, u16 peer_id)
bool ModChannelMgr::leaveChannel(const std::string &channel, session_t peer_id)
{
if (!channelRegistered(channel))
return false;
@ -135,7 +135,7 @@ bool ModChannelMgr::leaveChannel(const std::string &channel, u16 peer_id)
return consumerRemoved;
}
void ModChannelMgr::leaveAllChannels(u16 peer_id)
void ModChannelMgr::leaveAllChannels(session_t peer_id)
{
for (auto &channel_it : m_registered_channels)
channel_it.second->removeConsumer(peer_id);