* Rex merges, Messaging server

afrisby-3
Adam Frisby 2008-02-23 02:51:54 +00:00
parent ce0d1132f8
commit 6f00175d89
3 changed files with 688 additions and 693 deletions

View File

@ -39,20 +39,23 @@ namespace OpenSim.Grid.MessagingServer
{
/// <summary>
/// </summary>
public class OpenMessage_Main : conscmd_callback
public class OpenMessage_Main : BaseOpenSimServer, conscmd_callback
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private MessageServerConfig Cfg;
//public UserManager m_userManager;
//public UserLoginService m_loginService;
private LogBase m_console;
private LLUUID m_lastCreatedUser = LLUUID.Random();
[STAThread]
public static void Main(string[] args)
{
Console.WriteLine("Launching MessagingServer...");
log4net.Config.XmlConfigurator.Configure();
m_log.Info("Launching MessagingServer...");
OpenMessage_Main messageserver = new OpenMessage_Main();
@ -62,13 +65,8 @@ namespace OpenSim.Grid.MessagingServer
private OpenMessage_Main()
{
if (!Directory.Exists(Util.logDir()))
{
Directory.CreateDirectory(Util.logDir());
}
m_console =
new LogBase((Path.Combine(Util.logDir(), "opengrid-messagingserver-console.log")), "OpenMessage", this, true);
MainLog.Instance = m_console;
m_console = new ConsoleBase("OpenMessage", this);
MainConsole.Instance = m_console;
}
private void Work()
@ -77,7 +75,7 @@ namespace OpenSim.Grid.MessagingServer
while (true)
{
m_console.MainLogPrompt();
m_console.Prompt();
}
}
@ -85,9 +83,7 @@ namespace OpenSim.Grid.MessagingServer
{
Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml")));
MainLog.Instance.Verbose("REGION", "Starting HTTP process");
m_log.Info("[REGION]: Starting HTTP process");
BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort);
//httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
@ -105,10 +101,9 @@ namespace OpenSim.Grid.MessagingServer
//new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
httpServer.Start();
m_console.Status("SERVER", "Messageserver 0.4 - Startup complete");
m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete");
}
public void do_create(string what)
{
switch (what)
@ -121,7 +116,7 @@ namespace OpenSim.Grid.MessagingServer
//m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
} catch (Exception ex)
{
m_console.Error("SERVER", "Error creating user: {0}", ex.ToString());
m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString());
}
try
@ -131,15 +126,17 @@ namespace OpenSim.Grid.MessagingServer
}
catch (Exception ex)
{
m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString());
m_console.Error("[SERVER]: Error creating inventory for user: {0}", ex.ToString());
}
// m_lastCreatedUser = userID;
break;
}
}
public void RunCmd(string cmd, string[] cmdparams)
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "help":

View File

@ -43,7 +43,8 @@ namespace OpenSim.Grid.MessagingServer
{
public class MessageService
{
private LogBase m_log;
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private MessageServerConfig m_cfg;
//A hashtable of all current presences this server knows about
@ -58,14 +59,11 @@ namespace OpenSim.Grid.MessagingServer
// Hashtable containing work units that need to be processed
private Hashtable m_unProcessedWorkUnits = new Hashtable();
public MessageService(LogBase log, MessageServerConfig cfg)
public MessageService(MessageServerConfig cfg)
{
m_log = log;
m_cfg = cfg;
}
#region RegionComms Methods
/// <summary>
@ -84,7 +82,7 @@ namespace OpenSim.Grid.MessagingServer
ArrayList SendParams = new ArrayList();
SendParams.Add(PresenceParams);
MainLog.Instance.Verbose("PRESENCE", "Informing " + whichRegion.regionName + " at " + whichRegion.httpServerURI);
m_log.Info("[PRESENCE]: Informing " + whichRegion.regionName + " at " + whichRegion.httpServerURI);
// Send
XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams);
XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
@ -292,7 +290,7 @@ namespace OpenSim.Grid.MessagingServer
}
catch (WebException e)
{
MainLog.Instance.Warn("Error when trying to fetch Avatar's friends list: " +
m_log.Warn("Error when trying to fetch Avatar's friends list: " +
e.Message);
// Return Empty list (no friends)
}
@ -388,7 +386,7 @@ namespace OpenSim.Grid.MessagingServer
LLUUID AgentID = new LLUUID((string)requestData["agent_id"]);
ProcessLogOff(AgentID);
//ProcessLogOff(AgentID);
return new XmlRpcResponse();
@ -439,7 +437,7 @@ namespace OpenSim.Grid.MessagingServer
if (responseData.ContainsKey("error"))
{
m_log.Error("GRID","error received from grid server" + responseData["error"]);
m_log.Error("[GRID]: error received from grid server" + responseData["error"]);
return null;
}
@ -453,7 +451,7 @@ namespace OpenSim.Grid.MessagingServer
regionProfile = new RegionProfileData();
regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]);
regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
regionProfile.regionHandle = Helpers.UIntsToLong((regX * 256), (regY * 256));
regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
regionProfile.regionLocX = regX;
regionProfile.regionLocY = regY;
@ -465,7 +463,7 @@ namespace OpenSim.Grid.MessagingServer
}
catch (WebException)
{
MainLog.Instance.Error("GRID",
m_log.Error("[GRID]: " +
"Region lookup failed for: " + regionHandle.ToString() +
" - Is the GridServer down?");
return null;

View File

@ -39,7 +39,7 @@ namespace OpenSim.Grid.MessagingServer
{
public AgentCircuitData agentData = new AgentCircuitData();
public RegionProfileData regionData = new RegionProfileData();
public string httpURI = "";
public string httpURI = String.Empty;
public List<FriendListItem> friendData = new List<FriendListItem> ();
public List<LLUUID> subscriptionData = new List<LLUUID>();