Renamed notifyEvent to propagateEvent for the manager to avoid

'duplicated' name (notifyEvent also exists in each protocol).
This commit is contained in:
hiker 2015-10-21 17:18:27 +11:00
parent cce4793fa3
commit 1a0fb9fa4c
5 changed files with 15 additions and 9 deletions

View File

@ -108,7 +108,13 @@ void NetworkManager::setManualSocketsMode(bool manual)
} // setManualSocketsMode
//-----------------------------------------------------------------------------
void NetworkManager::notifyEvent(Event* event)
/** Is called from STKHost when an event (i.e. a package) is received. If the
* event indicates a new connection, the peer is added to the list of peers.
* It logs the package, and propagates the event to the ProtocollManager,
* which in turn will notify individual protocols.
* \param event Pointer to the event to propagate.
*/
void NetworkManager::propagateEvent(Event* event)
{
Log::verbose("NetworkManager", "EVENT received of type %d",
(int)(event->getType()));
@ -135,8 +141,8 @@ void NetworkManager::notifyEvent(Event* event)
}
// notify for the event now.
ProtocolManager::getInstance()->notifyEvent(event);
} // notifyEvent
ProtocolManager::getInstance()->propagateEvent(event);
} // propagateEvent
//-----------------------------------------------------------------------------

View File

@ -75,7 +75,7 @@ class NetworkManager : public AbstractSingleton<NetworkManager>
virtual void setManualSocketsMode(bool manual);
// message/packets related functions
virtual void notifyEvent(Event* event);
virtual void propagateEvent(Event* event);
virtual void sendPacket(const NetworkString& data,
bool reliable = true) = 0;
virtual void sendPacket(STKPeer* peer,

View File

@ -95,7 +95,7 @@ void ProtocolManager::abort()
} // abort
// ----------------------------------------------------------------------------
void ProtocolManager::notifyEvent(Event* event)
void ProtocolManager::propagateEvent(Event* event)
{
m_events_to_process.lock();
Event* event2 = new Event(*event);
@ -150,8 +150,8 @@ void ProtocolManager::notifyEvent(Event* event)
Log::warn("ProtocolManager",
"Received an event for %d that has no destination protocol.",
searched_protocol);
m_events_to_process.lock();
} // notifyEvent
m_events_to_process.unlock();
} // propagateEvent
// ----------------------------------------------------------------------------
void ProtocolManager::sendMessage(Protocol* sender, const NetworkString& message,

View File

@ -118,7 +118,7 @@ class ProtocolManager : public AbstractSingleton<ProtocolManager>,
* This function is called by the network manager each time there is an
* incoming packet.
*/
virtual void notifyEvent(Event* event);
virtual void propagateEvent(Event* event);
/*!
* \brief WILL BE COMMENTED LATER
*/

View File

@ -182,7 +182,7 @@ void* STKHost::mainLoop(void* self)
if (stk_event->getType() == EVENT_TYPE_MESSAGE)
logPacket(stk_event->data(), true);
if (event.type != ENET_EVENT_TYPE_NONE)
NetworkManager::getInstance()->notifyEvent(stk_event);
NetworkManager::getInstance()->propagateEvent(stk_event);
delete stk_event;
} // while enet_host_service
} // while !mustStopListening