Renamed notifyEvent to propagateEvent for the manager to avoid
'duplicated' name (notifyEvent also exists in each protocol).
This commit is contained in:
parent
cce4793fa3
commit
1a0fb9fa4c
@ -108,7 +108,13 @@ void NetworkManager::setManualSocketsMode(bool manual)
|
|||||||
} // setManualSocketsMode
|
} // 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",
|
Log::verbose("NetworkManager", "EVENT received of type %d",
|
||||||
(int)(event->getType()));
|
(int)(event->getType()));
|
||||||
@ -135,8 +141,8 @@ void NetworkManager::notifyEvent(Event* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// notify for the event now.
|
// notify for the event now.
|
||||||
ProtocolManager::getInstance()->notifyEvent(event);
|
ProtocolManager::getInstance()->propagateEvent(event);
|
||||||
} // notifyEvent
|
} // propagateEvent
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class NetworkManager : public AbstractSingleton<NetworkManager>
|
|||||||
virtual void setManualSocketsMode(bool manual);
|
virtual void setManualSocketsMode(bool manual);
|
||||||
|
|
||||||
// message/packets related functions
|
// message/packets related functions
|
||||||
virtual void notifyEvent(Event* event);
|
virtual void propagateEvent(Event* event);
|
||||||
virtual void sendPacket(const NetworkString& data,
|
virtual void sendPacket(const NetworkString& data,
|
||||||
bool reliable = true) = 0;
|
bool reliable = true) = 0;
|
||||||
virtual void sendPacket(STKPeer* peer,
|
virtual void sendPacket(STKPeer* peer,
|
||||||
|
@ -95,7 +95,7 @@ void ProtocolManager::abort()
|
|||||||
} // abort
|
} // abort
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void ProtocolManager::notifyEvent(Event* event)
|
void ProtocolManager::propagateEvent(Event* event)
|
||||||
{
|
{
|
||||||
m_events_to_process.lock();
|
m_events_to_process.lock();
|
||||||
Event* event2 = new Event(*event);
|
Event* event2 = new Event(*event);
|
||||||
@ -150,8 +150,8 @@ void ProtocolManager::notifyEvent(Event* event)
|
|||||||
Log::warn("ProtocolManager",
|
Log::warn("ProtocolManager",
|
||||||
"Received an event for %d that has no destination protocol.",
|
"Received an event for %d that has no destination protocol.",
|
||||||
searched_protocol);
|
searched_protocol);
|
||||||
m_events_to_process.lock();
|
m_events_to_process.unlock();
|
||||||
} // notifyEvent
|
} // propagateEvent
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void ProtocolManager::sendMessage(Protocol* sender, const NetworkString& message,
|
void ProtocolManager::sendMessage(Protocol* sender, const NetworkString& message,
|
||||||
|
@ -118,7 +118,7 @@ class ProtocolManager : public AbstractSingleton<ProtocolManager>,
|
|||||||
* This function is called by the network manager each time there is an
|
* This function is called by the network manager each time there is an
|
||||||
* incoming packet.
|
* incoming packet.
|
||||||
*/
|
*/
|
||||||
virtual void notifyEvent(Event* event);
|
virtual void propagateEvent(Event* event);
|
||||||
/*!
|
/*!
|
||||||
* \brief WILL BE COMMENTED LATER
|
* \brief WILL BE COMMENTED LATER
|
||||||
*/
|
*/
|
||||||
|
@ -182,7 +182,7 @@ void* STKHost::mainLoop(void* self)
|
|||||||
if (stk_event->getType() == EVENT_TYPE_MESSAGE)
|
if (stk_event->getType() == EVENT_TYPE_MESSAGE)
|
||||||
logPacket(stk_event->data(), true);
|
logPacket(stk_event->data(), true);
|
||||||
if (event.type != ENET_EVENT_TYPE_NONE)
|
if (event.type != ENET_EVENT_TYPE_NONE)
|
||||||
NetworkManager::getInstance()->notifyEvent(stk_event);
|
NetworkManager::getInstance()->propagateEvent(stk_event);
|
||||||
delete stk_event;
|
delete stk_event;
|
||||||
} // while enet_host_service
|
} // while enet_host_service
|
||||||
} // while !mustStopListening
|
} // while !mustStopListening
|
||||||
|
Loading…
Reference in New Issue
Block a user