Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nel/include/nel/net/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ namespace NLNET
virtual void deleteModule(IModule *module);

/** Virtual destructor.
* The destructor while unregister the module factory from the
* factory registry and ALL module factored
* The destructor will unregister the module factory from the
* factory registry and ALL modules created by this factory
* will also be deleted.
*/
virtual ~IModuleFactory();
Expand Down
1 change: 1 addition & 0 deletions nel/include/nel/net/module_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ namespace NLNET

virtual void _onModulePlugged(const TModulePtr &pluggedModule);
virtual void _onModuleUnplugged(const TModulePtr &pluggedModule);
bool isPlugged(IModule *module) const;

virtual void _sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message) =0;

Expand Down
2 changes: 1 addition & 1 deletion nel/src/net/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace NLNET

void IModuleFactory::registerModuleInFactory(TModulePtr module)
{
nlassert(module != NULL);
nlassert(module != nullptr);

nlassert(_ModuleInstances.find(module) == _ModuleInstances.end());

Expand Down
9 changes: 4 additions & 5 deletions nel/src/net/module_gateway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,7 @@ namespace NLNET
}
else
{
if (proxy->_SecurityData != nullptr)
delete proxy->_SecurityData;
delete proxy->_SecurityData;
proxy->_SecurityData = modDesc.SecDesc.SecurityData;
}
}
Expand Down Expand Up @@ -1240,7 +1239,7 @@ namespace NLNET
{
IModule *module = first->second;
if (removedModule->getGatewayRoute() != nullptr
|| module->getModuleId() != removedModule->getForeignModuleId())
|| module->getModuleId() != removedModule->getForeignModuleId())
{
module->_onModuleDown(removedModule);
}
Expand Down Expand Up @@ -1326,7 +1325,7 @@ namespace NLNET
if (addresseeProxy->getGatewayRoute() == nullptr)
{
// the module is local, just forward the call to the dispatcher
nlassert(senderProxy != NULL);
nlassert(senderProxy != nullptr);
nlassert(_ModuleProxies.find(senderProxy->getModuleProxyId()) != _ModuleProxies.end());

// invert the message for immediate dispatching if needed
Expand Down Expand Up @@ -1974,7 +1973,7 @@ namespace NLNET

CMessage updateMsg("MOD_UPD");

// compil all update in a single message
// compile all updates in a single message
while (!route->PendingEvents.empty())
{
CGatewayRoute::TPendingEvent &pe = route->PendingEvents.front();
Expand Down
12 changes: 4 additions & 8 deletions nel/src/net/module_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,10 @@ namespace NLNET
moduleName = className+toString(i++);
} while (_ModuleInstances.getB(moduleName) != nullptr);
}
else
else if (_ModuleInstances.getB(moduleName) != nullptr) // check that the module name is unique
{
// check that the module name is unique
if (_ModuleInstances.getB(moduleName) != nullptr)
{
nlwarning("createModule : the name '%s' is already used by another module, can't instantiate the module", moduleName.c_str());
return nullptr;
}
nlwarning("createModule : the name '%s' is already used by another module, can't instantiate the module", moduleName.c_str());
return nullptr;
}

IModuleFactory *mf = it->second;
Expand Down Expand Up @@ -449,7 +445,7 @@ namespace NLNET

void deleteModule(IModule *module) NL_OVERRIDE
{
nlassert(module != NULL);
nlassert(module != nullptr);

// remove module from trackers
nlassert(_ModuleInstances.getA(module) != NULL);
Expand Down
20 changes: 12 additions & 8 deletions nel/src/net/module_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ namespace NLNET

void CModuleSocket::_onModulePlugged(const TModulePtr &pluggedModule)
{
TPluggedModules::TBToAMap::const_iterator it(_PluggedModules.getBToAMap().find(pluggedModule));
if (it != _PluggedModules.getBToAMap().end())
if (isPlugged(pluggedModule))
{
throw IModule::EModuleAlreadyPluggedHere();
}
Expand All @@ -73,8 +72,7 @@ namespace NLNET

void CModuleSocket::_onModuleUnplugged(const TModulePtr &pluggedModule)
{
TPluggedModules::TBToAMap::const_iterator it(_PluggedModules.getBToAMap().find(pluggedModule));
if (it == _PluggedModules.getBToAMap().end())
if (!isPlugged(pluggedModule))
{
throw EModuleNotPluggedHere();
}
Expand All @@ -85,10 +83,17 @@ namespace NLNET
_PluggedModules.removeWithB(pluggedModule);
}

bool CModuleSocket::isPlugged(IModule *module) const
{
const TPluggedModules::TBToAMap &map = _PluggedModules.getBToAMap();
const TPluggedModules::TBToAMap::const_iterator &it(map.find(module));

return it != map.end();
}

void CModuleSocket::sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message)
{
TPluggedModules::TBToAMap::const_iterator it(_PluggedModules.getBToAMap().find(senderModule));
if (it == _PluggedModules.getBToAMap().end())
if (!isPlugged(senderModule))
{
throw EModuleNotPluggedHere();
}
Expand All @@ -100,8 +105,7 @@ namespace NLNET

void CModuleSocket::broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message)
{
TPluggedModules::TBToAMap::const_iterator it(_PluggedModules.getBToAMap().find(senderModule));
if (it == _PluggedModules.getBToAMap().end())
if (!isPlugged(senderModule))
{
throw EModuleNotPluggedHere();
}
Expand Down
24 changes: 12 additions & 12 deletions nel/tools/nel_unit_test/ut_net_module.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,24 @@ class CModuleType0 : public NLNET::CModuleBase
return ret;
}

void onServiceUp(const std::string &serviceName, NLNET::TServiceId serviceId)
void onServiceUp(const std::string &serviceName, NLNET::TServiceId serviceId) NL_OVERRIDE
{
}
/// A nel layer 5 service has stopped.
void onServiceDown(const std::string &serviceName, NLNET::TServiceId serviceId)
void onServiceDown(const std::string &serviceName, NLNET::TServiceId serviceId) NL_OVERRIDE
{
}
void onModuleUpdate()
void onModuleUpdate() NL_OVERRIDE
{
}
/** The service main loop is terminating it job', all module will be
* disconnected and removed after this callback.
*/
void onApplicationExit()
void onApplicationExit() NL_OVERRIDE
{
}

void onModuleUp(NLNET::IModuleProxy *moduleProxy)
void onModuleUp(NLNET::IModuleProxy *moduleProxy) NL_OVERRIDE
{
ModuleUpCalled++;

Expand Down Expand Up @@ -153,12 +153,12 @@ class CModuleType0 : public NLNET::CModuleBase
return false;
}

void onModuleSecurityChange(NLNET::IModuleProxy *moduleProxy)
void onModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) NL_OVERRIDE
{
SecurityUpdateCalled++;
}

void onModuleSocketEvent(NLNET::IModuleSocket *moduleSocket, IModule::TModuleSocketEvent eventType)
void onModuleSocketEvent(NLNET::IModuleSocket *moduleSocket, IModule::TModuleSocketEvent eventType) NL_OVERRIDE
{
}

Expand Down Expand Up @@ -457,28 +457,28 @@ class CInterceptor : public NLNET::IModuleInterceptable
SecurityUpdateCalled = 0;
}

virtual std::string buildModuleManifest() const
virtual std::string buildModuleManifest() const NL_OVERRIDE
{
return Name;
}

virtual void onModuleUp(NLNET::IModuleProxy *moduleProxy)
virtual void onModuleUp(NLNET::IModuleProxy *moduleProxy) NL_OVERRIDE
{
ModuleUpCalled++;
}

virtual void onModuleDown(NLNET::IModuleProxy *moduleProxy)
virtual void onModuleDown(NLNET::IModuleProxy *moduleProxy) NL_OVERRIDE
{
ModuleDownCalled++;
}

virtual bool onProcessModuleMessage(NLNET::IModuleProxy *senderModuleProxy, const NLNET::CMessage &message)
virtual bool onProcessModuleMessage(NLNET::IModuleProxy *senderModuleProxy, const NLNET::CMessage &message) NL_OVERRIDE
{
ProcessMessageCalled++;
return false;
}

virtual void onModuleSecurityChange(NLNET::IModuleProxy *moduleProxy)
virtual void onModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) NL_OVERRIDE
{
SecurityUpdateCalled++;
}
Expand Down
2 changes: 2 additions & 0 deletions ryzom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ IF(WITH_RYZOM_SERVER OR WITH_RYZOM_TOOLS)
FIND_PACKAGE(MySQL)
IF(MYSQL_FOUND)
ADD_SUBDIRECTORY(server)
ELSE ()
message(WARNING Server dependencies are not build due to missing MySQL package)
ENDIF()
ENDIF()

Expand Down
22 changes: 11 additions & 11 deletions ryzom/client/src/r2/dmc/client_edition_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ void CClientEditionModule::requestCreateScenario(CObject* scenario)
bool CClientEditionModule::requestTeleportOneCharacterToAnother(uint32 sessionId, uint32 sourceCharId, uint32 destCharId)
{
//H_AUTO(R2_CClientEditionModule_requestTeleportOneCharacterToAnother)
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return false);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return false);

CShareServerEditionItfProxy proxy(_ServerEditionProxy);
proxy.teleportOneCharacterToAnother(this, (TSessionId)sessionId, sourceCharId, destCharId);
Expand All @@ -736,7 +736,7 @@ void CClientEditionModule::requestUpdateRtScenario( CObject* scenario)
//H_AUTO(R2_CClientEditionModule_requestUpdateRtScenario)
// CSerialFactoryBackup fb;
CMessage message ("requestUpdateRtScenario");
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return);
CObjectSerializerServer obj(scenario);
obj.compress();
message.serial(obj);
Expand All @@ -750,7 +750,7 @@ void CClientEditionModule::requestCreatePrimitives()
{
//H_AUTO(R2_CClientEditionModule_requestCreatePrimitives)
CMessage message ("DBG_CREATE_PRIMITIVES");
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return);
_ServerEditionProxy->sendModuleMessage(this, message );
}

Expand All @@ -759,7 +759,7 @@ void CClientEditionModule::requestStopTest()
{
//H_AUTO(R2_CClientEditionModule_requestStopTest)
CMessage message ("STOP_TEST");
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return);
_ServerEditionProxy->sendModuleMessage(this, message );
}

Expand All @@ -770,7 +770,7 @@ bool CClientEditionModule::requestUploadScenario(CObject* scenario)
{
//H_AUTO(R2_CClientEditionModule_requestUploadScenario)
// CSerialFactoryBackup fb;
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return false);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return false);

CShareServerEditionItfProxy proxy(_ServerEditionProxy);
CObjectSerializerServer body(scenario);
Expand Down Expand Up @@ -827,7 +827,7 @@ void CClientEditionModule::requestSetNodeNoTest(const std::string& instanceId, c
{
//H_AUTO(R2_CClientEditionModule_requestSetNodeNoTest)
// CSerialFactoryBackup fb;
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return);
CShareServerEditionItfProxy proxy(_ServerEditionProxy);
CObjectSerializerServer value2(value);
value2.compress();
Expand All @@ -848,7 +848,7 @@ void CClientEditionModule::requestEraseNode( const std::string& instanceId, cons
}

// CSerialFactoryBackup fb;
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return);
CShareServerEditionItfProxy proxy(_ServerEditionProxy);
uint32 messageId = _ServerAnswerForseener->onNodeErased(instanceId, attrName, position);
proxy.onNodeEraseAsked(this, messageId, instanceId, attrName, position);
Expand All @@ -873,7 +873,7 @@ void CClientEditionModule::requestInsertNode(const std::string& instanceId, cons
}
}
// CSerialFactoryBackup fb;
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return);
CShareServerEditionItfProxy proxy(_ServerEditionProxy);
CObjectSerializerServer value2(value);
value2.compress();
Expand Down Expand Up @@ -904,7 +904,7 @@ void CClientEditionModule::requestMoveNode(
if (dest) nlassert(!dest->getGhost());
// CSerialFactoryBackup fb;

BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return);
CShareServerEditionItfProxy proxy(_ServerEditionProxy);
uint32 messageId = _ServerAnswerForseener->onNodeMoved(instanceId, attrName, position, destInstanceId, destAttrName, destPosition);
proxy.onNodeMoveAsked(this, messageId, instanceId, attrName, position, destInstanceId, destAttrName, destPosition);
Expand All @@ -915,7 +915,7 @@ void CClientEditionModule::requestMapConnection( uint32 scenarioId, bool mustTp,
{
//H_AUTO(R2_CClientEditionModule_requestMapConnection)
// CSerialFactoryBackup fb;
BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return);
CShareServerEditionItfProxy proxy(_ServerEditionProxy);
proxy.onMapConnectionAsked(this, (TSessionId)scenarioId, mustTp, mustUpdateHighLevel, R2::TUserRole::ur_editor);
}
Expand Down Expand Up @@ -1216,7 +1216,7 @@ bool CClientEditionModule::requestStartScenario()
{
//H_AUTO(R2_CClientEditionModule_ )

BOMB_IF(_ServerEditionProxy == NULL, "Server Edition Module not connected", return false);
BOMB_IF(_ServerEditionProxy == nullptr, "Server Edition Module not connected", return false);

CEditor::connectionMsg("uimR2EDGoToDMMode");

Expand Down
8 changes: 2 additions & 6 deletions ryzom/common/src/game_share/character_sync_itf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1834,9 +1834,7 @@ namespace CHARSYNC

for (; first != last; ++first)
{
NLNET::IModuleProxy *proxy = *first;

proxy->sendModuleMessage(sender, message);
(*first)->sendModuleMessage(sender, message);
}

}
Expand All @@ -1854,9 +1852,7 @@ namespace CHARSYNC

for (; first != last; ++first)
{
NLNET::IModuleProxy *proxy = *first;

proxy->sendModuleMessage(sender, message);
(*first)->sendModuleMessage(sender, message);
}

}
Expand Down
4 changes: 1 addition & 3 deletions ryzom/common/src/game_share/generate_module_interface.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,7 @@ namespace <xsl:value-of select="@name"/>

for (; first != last; ++first)
{
NLNET::IModuleProxy *proxy = *first;

proxy->sendModuleMessage(sender, message);
(*first)->sendModuleMessage(sender, message);
}

}<xsl:text>
Expand Down
Loading
Loading