From 950389a2633034fa8ff93dfa97dc14db46d40efc Mon Sep 17 00:00:00 2001
From: gareth
Date: Wed, 11 Apr 2007 08:51:39 +0000
Subject: Added POST handler for /sims/ in the grid server Removed asset/user
config in grid mode in the region server Added "create user" command in the
user server console Begun buggy code to send sim details to the grid at
startup Drank whole pack of red bull in one night and made stupid jokes in
SVN logs and C# comments
---
OpenSim.RegionServer/RegionInfo.cs | 104 +++++++++++++++----------------------
1 file changed, 41 insertions(+), 63 deletions(-)
(limited to 'OpenSim.RegionServer/RegionInfo.cs')
diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs
index cf0c075..e120198 100644
--- a/OpenSim.RegionServer/RegionInfo.cs
+++ b/OpenSim.RegionServer/RegionInfo.cs
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
+using System.Net;
+using System.Web;
+using System.IO;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using libsecondlife;
@@ -34,7 +37,37 @@ namespace OpenSim
public RegionInfo()
{
- }
+ }
+
+ public void SaveToGrid()
+ {
+ string reqtext;
+ reqtext="" + this.GridSendKey + "";
+ reqtext+="";
+ reqtext+="" + this.SimUUID.ToString() + "";
+ reqtext+="" + this.RegionName + "";
+ reqtext+="" + this.IPListenAddr + "";
+ reqtext+="" + this.IPListenPort.ToString() + "";
+ reqtext+="" + this.RegionLocX.ToString() + "";
+ reqtext+="" + this.RegionLocY.ToString() + "";
+ reqtext+="1";
+ reqtext+="";
+
+ WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString());
+ GridSaveReq.Method = "POST";
+ GridSaveReq.ContentType = "text/plaintext";
+ GridSaveReq.ContentLength = reqtext.Length;
+
+ StreamWriter stOut = new StreamWriter(GridSaveReq.GetRequestStream(), System.Text.Encoding.ASCII);
+ stOut.Write(reqtext);
+ stOut.Close();
+
+ StreamReader stIn = new StreamReader(GridSaveReq.GetResponse().GetResponseStream());
+ string GridResponse = stIn.ReadToEnd();
+ stIn.Close();
+
+ OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse);
+ }
public void InitConfig(bool sandboxMode, IGenericConfig configData)
{
@@ -122,31 +155,7 @@ namespace OpenSim
{
//shouldn't be reading this data in here, it should be up to the classes implementing the server interfaces to read what they need from the config object
- // Asset Server URL
- attri = "";
- attri = configData.GetAttribute("AssetServerURL");
- if (attri == "")
- {
- this.AssetURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL: ");
- configData.SetAttribute("AssetServerURL", this.AssetURL);
- }
- else
- {
- this.AssetURL = attri;
- }
- //Asset Server key
- attri = "";
- attri = configData.GetAttribute("AssetServerKey");
- if (attri == "")
- {
- this.AssetSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server key: ");
- configData.SetAttribute("AssetServerKey", this.AssetSendKey);
- }
- else
- {
- this.AssetSendKey = attri;
- }
- //Grid Sever URL
+ //Grid Server URL
attri = "";
attri = configData.GetAttribute("GridServerURL");
if (attri == "")
@@ -158,6 +167,7 @@ namespace OpenSim
{
this.GridURL = attri;
}
+
//Grid Send Key
attri = "";
attri = configData.GetAttribute("GridSendKey");
@@ -170,6 +180,7 @@ namespace OpenSim
{
this.GridSendKey = attri;
}
+
//Grid Receive Key
attri = "";
attri = configData.GetAttribute("GridRecvKey");
@@ -181,45 +192,12 @@ namespace OpenSim
else
{
this.GridRecvKey = attri;
- }
- //User Server URL
- attri = "";
- attri = configData.GetAttribute("UserServerURL");
- if (attri == "")
- {
- this.UserURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("User server URL: ");
- configData.SetAttribute("UserServerURL", this.UserURL);
- }
- else
- {
- this.UserURL = attri;
- }
- //User Send Key
- attri = "";
- attri = configData.GetAttribute("UserSendKey");
- if (attri == "")
- {
- this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server: ");
- configData.SetAttribute("UserSendKey", this.UserSendKey);
- }
- else
- {
- this.UserSendKey = attri;
- }
- //User Receive Key
- attri = "";
- attri = configData.GetAttribute("UserRecvKey");
- if (attri == "")
- {
- this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server: ");
- configData.SetAttribute("UserRecvKey", this.UserRecvKey);
- }
- else
- {
- this.UserRecvKey = attri;
- }
+ }
+
+
}
this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
+ this.SaveToGrid();
configData.Commit();
}
catch (Exception e)
--
cgit v1.1