From 04dbcee74c29f5a5876cc5cd14a01699c4716f6d Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 6 Jan 2008 20:10:29 +0000 Subject: * A few more Message Server comms related updates --- OpenSim/Framework/MessageServerConfig.cs | 21 ++++++++ OpenSim/Framework/Servers/MessageServerInfo.cs | 4 ++ OpenSim/Grid/GridServer/GridManager.cs | 63 +++++++++++++++++++++- OpenSim/Grid/GridServer/Main.cs | 5 ++ OpenSim/Grid/MessagingServer/Main.cs | 8 +-- OpenSim/Grid/UserServer/MessageServersConnector.cs | 4 +- 6 files changed, 95 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/MessageServerConfig.cs b/OpenSim/Framework/MessageServerConfig.cs index 2859c25..5cef362 100644 --- a/OpenSim/Framework/MessageServerConfig.cs +++ b/OpenSim/Framework/MessageServerConfig.cs @@ -41,6 +41,10 @@ namespace OpenSim.Framework public string UserSendKey = ""; public string UserRecvKey = ""; + public string GridServerURL = ""; + public string GridSendKey = ""; + public string GridRecvKey = ""; + public string DatabaseProvider = ""; public string GridCommsProvider = ""; @@ -68,6 +72,14 @@ namespace OpenSim.Framework "Key to send to user server", "null", false); configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false); + configMember.addConfigurationOption("default_grid_server", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default Grid Server URI", + "http://127.0.0.1:8002/", false); + configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to send to grid server", "null", false); + configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to expect from user server", "null", false); configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); @@ -96,6 +108,15 @@ namespace OpenSim.Framework case "user_recv_key": UserRecvKey = (string)configuration_result; break; + case "default_grid_server": + GridServerURL = (string)configuration_result; + break; + case "grid_send_key": + GridSendKey = (string)configuration_result; + break; + case "grid_recv_key": + GridRecvKey = (string)configuration_result; + break; case "database_provider": DatabaseProvider = (string)configuration_result; break; diff --git a/OpenSim/Framework/Servers/MessageServerInfo.cs b/OpenSim/Framework/Servers/MessageServerInfo.cs index 13d65f9..9d5fa8a 100644 --- a/OpenSim/Framework/Servers/MessageServerInfo.cs +++ b/OpenSim/Framework/Servers/MessageServerInfo.cs @@ -13,5 +13,9 @@ namespace OpenSim.Framework.Servers public MessageServerInfo() { } + public override string ToString() + { + return URI; + } } } diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 31500c0..61f1fd7 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -36,6 +36,8 @@ using Nwc.XmlRpc; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Data; +using OpenSim.Framework.Servers; + namespace OpenSim.Grid.GridServer { @@ -43,6 +45,7 @@ namespace OpenSim.Grid.GridServer { private Dictionary _plugins = new Dictionary(); private Dictionary _logplugins = new Dictionary(); + private List _MessageServers = new List(); public GridConfig config; @@ -414,7 +417,20 @@ namespace OpenSim.Grid.GridServer responseData["allow_forceful_banlines"] = config.AllowForcefulBanlines; + // Instead of sending a multitude of message servers to the registering sim + // we should probably be sending a single one and parhaps it's backup + // that has responsibility over routing it's messages. + + // The Sim won't be contacting us again about any of the message server stuff during it's time up. + + responseData["messageserver_count"] = _MessageServers.Count; + for (int i = 0; i < _MessageServers.Count; i++) + { + responseData["messageserver_uri" + i] = _MessageServers[i].URI; + responseData["messageserver_sendkey" + i] = _MessageServers[i].sendkey; + responseData["messageserver_recvkey" + i] = _MessageServers[i].recvkey; + } return response; } @@ -424,6 +440,7 @@ namespace OpenSim.Grid.GridServer responseData["error"] = "Another region already exists at that location. Try another"; return response; } + } public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) @@ -767,5 +784,49 @@ namespace OpenSim.Grid.GridServer return "ERROR! Could not save to database! (" + e.ToString() + ")"; } } + public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = new Hashtable(); + + if (requestData.Contains("uri")) + { + string URI = (string)requestData["URI"]; + string sendkey = (string)requestData["sendkey"]; + string recvkey = (string)requestData["recvkey"]; + MessageServerInfo m = new MessageServerInfo(); + m.URI = URI; + m.sendkey = sendkey; + m.recvkey = recvkey; + if (!_MessageServers.Contains(m)) + _MessageServers.Add(m); + responseData["responsestring"] = "TRUE"; + response.Value = responseData; + } + return response; + } + public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = new Hashtable(); + + if (requestData.Contains("uri")) + { + string URI = (string)requestData["uri"]; + string sendkey = (string)requestData["sendkey"]; + string recvkey = (string)requestData["recvkey"]; + MessageServerInfo m = new MessageServerInfo(); + m.URI = URI; + m.sendkey = sendkey; + m.recvkey = recvkey; + if (_MessageServers.Contains(m)) + _MessageServers.Remove(m); + responseData["responsestring"] = "TRUE"; + response.Value = responseData; + } + return response; + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index cdd37c4..6bb4c75 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs @@ -119,6 +119,11 @@ namespace OpenSim.Grid.GridServer httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); + // Message Server ---> Grid Server + httpServer.AddXmlRPCHandler("register_messageserver", m_gridManager.XmlRPCRegisterMessageServer); + httpServer.AddXmlRPCHandler("deregister_messageserver", m_gridManager.XmlRPCDeRegisterMessageServer); + + httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod)); httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod)); diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index 8f64113..a7c3a2a 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -85,13 +85,7 @@ namespace OpenSim.Grid.MessagingServer { Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); - //MainLog.Instance.Verbose("REGION", "Establishing data connection"); - //m_userManager = new UserManager(); - //m_userManager._config = Cfg; - //m_userManager.AddPlugin(Cfg.DatabaseProvider); - - //m_loginService = new UserLoginService( - //m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); + MainLog.Instance.Verbose("REGION", "Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs index deec739..7966868 100644 --- a/OpenSim/Grid/UserServer/MessageServersConnector.cs +++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs @@ -72,7 +72,7 @@ namespace OpenSim.Grid.UserServer if (requestData.Contains("uri")) { - string URI = (string)requestData["URI"]; + string URI = (string)requestData["uri"]; string sendkey=(string)requestData["sendkey"]; string recvkey=(string)requestData["recvkey"]; MessageServerInfo m = new MessageServerInfo(); @@ -146,7 +146,7 @@ namespace OpenSim.Grid.UserServer ArrayList SendParams = new ArrayList(); SendParams.Add(reqparams); - XmlRpcRequest GridReq = new XmlRpcRequest("user_login", SendParams); + XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams); XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000); m_log.Verbose("LOGIN","Notified : " + serv.URI + " about user login"); -- cgit v1.1