* A few more Message Server comms related updates

afrisby
Teravus Ovares 2008-01-06 20:10:29 +00:00
parent 9985d53681
commit 04dbcee74c
6 changed files with 95 additions and 10 deletions

View File

@ -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;

View File

@ -13,5 +13,9 @@ namespace OpenSim.Framework.Servers
public MessageServerInfo()
{
}
public override string ToString()
{
return URI;
}
}
}

View File

@ -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<string, IGridData> _plugins = new Dictionary<string, IGridData>();
private Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>();
private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
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;
}
}
}
}

View File

@ -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));

View File

@ -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);

View File

@ -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");