* Message Server Linkages (still not ready for use so don't start it yet)

0.6.0-stable
Teravus Ovares 2008-02-25 06:33:14 +00:00
parent 61200b469c
commit b831a91852
6 changed files with 153 additions and 16 deletions

View File

@ -45,6 +45,7 @@ namespace OpenSim.Framework
public string GridServerURL = String.Empty; public string GridServerURL = String.Empty;
public string GridSendKey = String.Empty; public string GridSendKey = String.Empty;
public string GridRecvKey = String.Empty; public string GridRecvKey = String.Empty;
public string MessageServerIP = String.Empty;
public string DatabaseProvider = String.Empty; public string DatabaseProvider = String.Empty;
public string GridCommsProvider = String.Empty; public string GridCommsProvider = String.Empty;
@ -92,6 +93,8 @@ namespace OpenSim.Framework
"Http Listener port", DefaultHttpPort.ToString(), false); "Http Listener port", DefaultHttpPort.ToString(), false);
configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Use SSL? true/false", DefaultHttpSSL.ToString(), false); "Use SSL? true/false", DefaultHttpSSL.ToString(), false);
configMember.addConfigurationOption("published_ip", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"My Published IP Address", "127.0.0.1", false);
} }
@ -130,6 +133,9 @@ namespace OpenSim.Framework
case "region_comms_provider": case "region_comms_provider":
GridCommsProvider = (string)configuration_result; GridCommsProvider = (string)configuration_result;
break; break;
case "published_ip":
MessageServerIP = (string)configuration_result;
break;
} }
return true; return true;

View File

@ -44,6 +44,7 @@ namespace OpenSim.Grid.MessagingServer
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private MessageServerConfig Cfg; private MessageServerConfig Cfg;
private MessageService msgsvc;
//public UserManager m_userManager; //public UserManager m_userManager;
//public UserLoginService m_loginService; //public UserLoginService m_loginService;
@ -57,6 +58,8 @@ namespace OpenSim.Grid.MessagingServer
m_log.Info("Launching MessagingServer..."); m_log.Info("Launching MessagingServer...");
OpenMessage_Main messageserver = new OpenMessage_Main(); OpenMessage_Main messageserver = new OpenMessage_Main();
messageserver.Startup(); messageserver.Startup();
@ -86,7 +89,11 @@ namespace OpenSim.Grid.MessagingServer
m_log.Info("[REGION]: Starting HTTP process"); m_log.Info("[REGION]: Starting HTTP process");
BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort);
//httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); msgsvc = new MessageService(Cfg);
if (msgsvc.registerWithUserServer())
{
httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
//httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); //httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
//httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); //httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
@ -103,6 +110,11 @@ namespace OpenSim.Grid.MessagingServer
httpServer.Start(); httpServer.Start();
m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete"); m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete");
} }
else
{
m_log.Error("[STARTUP]: Unable to connect to User Server");
}
}
public void do_create(string what) public void do_create(string what)
{ {
@ -144,6 +156,7 @@ namespace OpenSim.Grid.MessagingServer
break; break;
case "shutdown": case "shutdown":
msgsvc.deregisterWithUserServer();
m_console.Close(); m_console.Close();
Environment.Exit(0); Environment.Exit(0);
break; break;

View File

@ -333,7 +333,7 @@ namespace OpenSim.Grid.MessagingServer
/// <returns></returns> /// <returns></returns>
public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) public XmlRpcResponse UserLoggedOn(XmlRpcRequest request)
{ {
m_log.Info("[LOGON]: User logged on, building indexes for user");
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
AgentCircuitData agentData = new AgentCircuitData(); AgentCircuitData agentData = new AgentCircuitData();
agentData.SessionID = new LLUUID((string)requestData["session_id"]); agentData.SessionID = new LLUUID((string)requestData["session_id"]);
@ -471,6 +471,108 @@ namespace OpenSim.Grid.MessagingServer
return regionProfile; return regionProfile;
}
public bool registerWithUserServer ()
{
Hashtable UserParams = new Hashtable();
// Login / Authentication
if (m_cfg.HttpSSL)
{
UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
}
else
{
UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
}
UserParams["recvkey"] = m_cfg.UserRecvKey;
UserParams["sendkey"] = m_cfg.UserRecvKey;
// Package into an XMLRPC Request
ArrayList SendParams = new ArrayList();
SendParams.Add(UserParams);
// Send Request
XmlRpcRequest UserReq;
XmlRpcResponse UserResp;
try
{
UserReq = new XmlRpcRequest("register_messageserver", SendParams);
UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
} catch (Exception ex)
{
m_log.Error("Unable to connect to grid. Grid server not running?");
throw(ex);
}
Hashtable GridRespData = (Hashtable)UserResp.Value;
Hashtable griddatahash = GridRespData;
// Process Response
if (GridRespData.ContainsKey("responsestring"))
{
return true;
}
else
{
return false;
}
}
public bool deregisterWithUserServer()
{
Hashtable UserParams = new Hashtable();
// Login / Authentication
if (m_cfg.HttpSSL)
{
UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
}
else
{
UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
}
UserParams["recvkey"] = m_cfg.UserRecvKey;
UserParams["sendkey"] = m_cfg.UserRecvKey;
// Package into an XMLRPC Request
ArrayList SendParams = new ArrayList();
SendParams.Add(UserParams);
// Send Request
XmlRpcRequest UserReq;
XmlRpcResponse UserResp;
try
{
UserReq = new XmlRpcRequest("deregister_messageserver", SendParams);
UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
}
catch (Exception ex)
{
m_log.Error("Unable to connect to grid. Grid server not running?");
throw (ex);
}
Hashtable UserRespData = (Hashtable)UserResp.Value;
Hashtable userdatahash = UserRespData;
// Process Response
if (UserRespData.ContainsKey("responsestring"))
{
return true;
}
else
{
return false;
}
} }
#endregion #endregion
} }

View File

@ -227,6 +227,7 @@ namespace OpenSim.Grid.UserServer
public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position)
{ {
m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, Position); m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, Position);
} }

View File

@ -119,7 +119,7 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("uri")) if (requestData.Contains("uri"))
{ {
string URI = (string)requestData["URI"]; string URI = (string)requestData["uri"];
DeRegisterMessageServer(URI); DeRegisterMessageServer(URI);
responseData["responsestring"] = "TRUE"; responseData["responsestring"] = "TRUE";
@ -153,6 +153,14 @@ namespace OpenSim.Grid.UserServer
public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position)
{ {
// Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D ) // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D )
if (MessageServers.Count > 0)
{
m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers");
}
else
{
m_log.Info("[MSGCONNECTOR]: No Message Servers registered, ignoring");
}
foreach (MessageServerInfo serv in MessageServers.Values) foreach (MessageServerInfo serv in MessageServers.Values)
{ {
NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, regionhandle, Position); NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, regionhandle, Position);

View File

@ -145,6 +145,12 @@ namespace OpenSim.Grid.UserServer
"[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}", "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
} }
handler001 = OnUserLoggedInAtLocation;
if (handler001 != null)
{
m_log.Info("[LOGIN]: Letting other objects know about login");
handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos);
}
} }
catch (Exception) catch (Exception)
{ {
@ -219,6 +225,7 @@ namespace OpenSim.Grid.UserServer
handler001 = OnUserLoggedInAtLocation; handler001 = OnUserLoggedInAtLocation;
if (handler001 != null) if (handler001 != null)
{ {
m_log.Info("[LOGIN]: Letting other objects know about login");
handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos); handler001(theUser.UUID, theUser.currentAgent.sessionID, theUser.currentAgent.currentRegion, theUser.currentAgent.currentHandle, theUser.currentAgent.currentPos);
} }
} }