* 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 GridSendKey = String.Empty;
public string GridRecvKey = String.Empty;
public string MessageServerIP = String.Empty;
public string DatabaseProvider = String.Empty;
public string GridCommsProvider = String.Empty;
@ -92,6 +93,8 @@ namespace OpenSim.Framework
"Http Listener port", DefaultHttpPort.ToString(), false);
configMember.addConfigurationOption("http_ssl", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"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":
GridCommsProvider = (string)configuration_result;
break;
case "published_ip":
MessageServerIP = (string)configuration_result;
break;
}
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 MessageServerConfig Cfg;
private MessageService msgsvc;
//public UserManager m_userManager;
//public UserLoginService m_loginService;
@ -57,6 +58,8 @@ namespace OpenSim.Grid.MessagingServer
m_log.Info("Launching MessagingServer...");
OpenMessage_Main messageserver = new OpenMessage_Main();
messageserver.Startup();
@ -85,23 +88,32 @@ namespace OpenSim.Grid.MessagingServer
m_log.Info("[REGION]: Starting HTTP process");
BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort);
//httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
//httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
//httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
//httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
//httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend);
//httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend);
//httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
//httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
msgsvc = new MessageService(Cfg);
//httpServer.AddStreamHandler(
if (msgsvc.registerWithUserServer())
{
httpServer.AddXmlRPCHandler("login_to_simulator", msgsvc.UserLoggedOn);
//httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
//httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID);
//httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar);
//httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend);
//httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend);
//httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
//httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
//httpServer.AddStreamHandler(
//new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
httpServer.Start();
m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete");
httpServer.Start();
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)
@ -144,6 +156,7 @@ namespace OpenSim.Grid.MessagingServer
break;
case "shutdown":
msgsvc.deregisterWithUserServer();
m_console.Close();
Environment.Exit(0);
break;

View File

@ -333,7 +333,7 @@ namespace OpenSim.Grid.MessagingServer
/// <returns></returns>
public XmlRpcResponse UserLoggedOn(XmlRpcRequest request)
{
m_log.Info("[LOGON]: User logged on, building indexes for user");
Hashtable requestData = (Hashtable)request.Params[0];
AgentCircuitData agentData = new AgentCircuitData();
agentData.SessionID = new LLUUID((string)requestData["session_id"]);
@ -471,6 +471,108 @@ namespace OpenSim.Grid.MessagingServer
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
}

View File

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

View File

@ -119,7 +119,7 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("uri"))
{
string URI = (string)requestData["URI"];
string URI = (string)requestData["uri"];
DeRegisterMessageServer(URI);
responseData["responsestring"] = "TRUE";
@ -153,6 +153,14 @@ namespace OpenSim.Grid.UserServer
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 )
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)
{
NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, regionhandle, Position);

View File

@ -144,7 +144,13 @@ namespace OpenSim.Grid.UserServer
m_log.ErrorFormat(
"[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
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)
{
@ -219,6 +225,7 @@ namespace OpenSim.Grid.UserServer
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);
}
}