From f9a67ab5f0aefe9033593babb790d6c1c74628ec Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Thu, 5 Jun 2008 20:18:15 +0000 Subject: Mantis#1460. Thank you, CMickeyb for a patch that addresses: I'm getting an unhandled exception in openxmlrpcchannel during simulator initialization. I have two objects in different regions that open remote data channels in the state_entry event. It appears that the state_entry call is executing before the postinitialize method is called in xmlrpcmodule (the exception occurs because m_openChannels is not initialized). --- .../Modules/Scripting/XMLRPC/XMLRPCModule.cs | 33 +++++++++++++++------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs index 79cd151..bde90bc 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs @@ -97,12 +97,23 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC public void Initialise(Scene scene, IConfigSource config) { - try - { - m_remoteDataPort = config.Configs["Network"].GetInt("remoteDataPort", m_remoteDataPort); - } - catch (Exception) + // We need to create these early because the scripts might be calling + // But since this gets called for every region, we need to make sure they + // get called only one time (or we lose any open channels) + if (null == m_openChannels) { + m_openChannels = new Dictionary(); + m_rpcPending = new Dictionary(); + m_rpcPendingResponses = new Dictionary(); + m_pendingSRDResponses = new Dictionary(); + + try + { + m_remoteDataPort = config.Configs["Network"].GetInt("remoteDataPort", m_remoteDataPort); + } + catch (Exception) + { + } } if (!m_scenes.Contains(scene)) @@ -117,11 +128,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC { if (IsEnabled()) { - m_openChannels = new Dictionary(); - m_rpcPending = new Dictionary(); - m_rpcPendingResponses = new Dictionary(); - m_pendingSRDResponses = new Dictionary(); - // Start http server // Attach xmlrpc handlers m_log.Info("[REMOTE_DATA]: " + @@ -177,6 +183,13 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC { LLUUID newChannel = LLUUID.Zero; + // This should no longer happen, but the check is reasonable anyway + if (null == m_openChannels) + { + m_log.Warn("[RemoteDataReply] Attempt to open channel before initialization is complete"); + return newChannel; + } + //Is a dupe? foreach (RPCChannelInfo ci in m_openChannels.Values) { -- cgit v1.1