aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-04-11 09:29:06 +0000
committerMW2007-04-11 09:29:06 +0000
commit435d61661bb4a80f04304968feac5f2828cda104 (patch)
tree819f9a6a8ce39bded62e3ee29061762bd6028685
parentAdded POST handler for /sims/ in the grid server (diff)
downloadopensim-SC_OLD-435d61661bb4a80f04304968feac5f2828cda104.zip
opensim-SC_OLD-435d61661bb4a80f04304968feac5f2828cda104.tar.gz
opensim-SC_OLD-435d61661bb4a80f04304968feac5f2828cda104.tar.bz2
opensim-SC_OLD-435d61661bb4a80f04304968feac5f2828cda104.tar.xz
-rw-r--r--OpenSim.Framework/UserProfileManager.cs8
-rw-r--r--OpenSim.RegionServer/RegionInfo.cs83
2 files changed, 49 insertions, 42 deletions
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs
index 38ca5df..3f0d665 100644
--- a/OpenSim.Framework/UserProfileManager.cs
+++ b/OpenSim.Framework/UserProfileManager.cs
@@ -90,8 +90,10 @@ namespace OpenSim.Framework.User
90 90
91 LLUUID AgentID = TheUser.UUID; 91 LLUUID AgentID = TheUser.UUID;
92 TheUser.InitSessionData(); 92 TheUser.InitSessionData();
93 SimProfile SimInfo = new SimProfile(); 93
94 SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey); 94 //for loading data from a grid server, make any changes in CustomiseResponse() (or create a sub class of this and override that method)
95 //SimProfile SimInfo = new SimProfile();
96 //SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
95 97
96 98
97 Hashtable GlobalT = new Hashtable(); 99 Hashtable GlobalT = new Hashtable();
@@ -146,7 +148,7 @@ namespace OpenSim.Framework.User
146 InitialOutfit.Add(InitialOutfitHash); 148 InitialOutfit.Add(InitialOutfitHash);
147 149
148 uint circode = (uint)(Util.RandomClass.Next()); 150 uint circode = (uint)(Util.RandomClass.Next());
149 TheUser.AddSimCircuit(circode, SimInfo.UUID); 151 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
150 152
151 responseData["last_name"] = TheUser.lastname; 153 responseData["last_name"] = TheUser.lastname;
152 responseData["ui-config"] = ui_config; 154 responseData["ui-config"] = ui_config;
diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs
index e120198..83c69ff 100644
--- a/OpenSim.RegionServer/RegionInfo.cs
+++ b/OpenSim.RegionServer/RegionInfo.cs
@@ -1,9 +1,9 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Net; 4using System.Net;
5using System.Web; 5using System.Web;
6using System.IO; 6using System.IO;
7using OpenSim.Framework.Interfaces; 7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Utilities; 8using OpenSim.Framework.Utilities;
9using libsecondlife; 9using libsecondlife;
@@ -37,37 +37,39 @@ namespace OpenSim
37 public RegionInfo() 37 public RegionInfo()
38 { 38 {
39 39
40 } 40 }
41 41
42 public void SaveToGrid() 42 public void SaveToGrid()
43 { 43 {
44 string reqtext; 44 //we really want to keep any server connection code out of here and out of the code code
45 reqtext="<authkey>" + this.GridSendKey + "</authkey>"; 45 // and put it in the server connection classes (those inheriting from IGridServer etc)
46 reqtext+="<sim>"; 46 string reqtext;
47 reqtext+="<uuid>" + this.SimUUID.ToString() + "</uuid>"; 47 reqtext = "<authkey>" + this.GridSendKey + "</authkey>";
48 reqtext+="<regionname>" + this.RegionName + "</regionname>"; 48 reqtext += "<sim>";
49 reqtext+="<sim_ip>" + this.IPListenAddr + "</sim_ip>"; 49 reqtext += "<uuid>" + this.SimUUID.ToString() + "</uuid>";
50 reqtext+="<sim_port>" + this.IPListenPort.ToString() + "</sim_port>"; 50 reqtext += "<regionname>" + this.RegionName + "</regionname>";
51 reqtext+="<region_locx>" + this.RegionLocX.ToString() + "</region_locx>"; 51 reqtext += "<sim_ip>" + this.IPListenAddr + "</sim_ip>";
52 reqtext+="<region_locy>" + this.RegionLocY.ToString() + "</region_locy>"; 52 reqtext += "<sim_port>" + this.IPListenPort.ToString() + "</sim_port>";
53 reqtext+="<estate_id>1</estate_id>"; 53 reqtext += "<region_locx>" + this.RegionLocX.ToString() + "</region_locx>";
54 reqtext+="</sim>"; 54 reqtext += "<region_locy>" + this.RegionLocY.ToString() + "</region_locy>";
55 55 reqtext += "<estate_id>1</estate_id>";
56 WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString()); 56 reqtext += "</sim>";
57 GridSaveReq.Method = "POST"; 57
58 GridSaveReq.ContentType = "text/plaintext"; 58 WebRequest GridSaveReq = WebRequest.Create(this.GridURL + "sims/" + this.SimUUID.ToString());
59 GridSaveReq.ContentLength = reqtext.Length; 59 GridSaveReq.Method = "POST";
60 60 GridSaveReq.ContentType = "text/plaintext";
61 StreamWriter stOut = new StreamWriter(GridSaveReq.GetRequestStream(), System.Text.Encoding.ASCII); 61 GridSaveReq.ContentLength = reqtext.Length;
62 stOut.Write(reqtext); 62
63 stOut.Close(); 63 StreamWriter stOut = new StreamWriter(GridSaveReq.GetRequestStream(), System.Text.Encoding.ASCII);
64 64 stOut.Write(reqtext);
65 StreamReader stIn = new StreamReader(GridSaveReq.GetResponse().GetResponseStream()); 65 stOut.Close();
66 string GridResponse = stIn.ReadToEnd(); 66
67 stIn.Close(); 67 StreamReader stIn = new StreamReader(GridSaveReq.GetResponse().GetResponseStream());
68 68 string GridResponse = stIn.ReadToEnd();
69 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse); 69 stIn.Close();
70 } 70
71 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("RegionInfo.CS:SaveToGrid() - Grid said: " + GridResponse);
72 }
71 73
72 public void InitConfig(bool sandboxMode, IGenericConfig configData) 74 public void InitConfig(bool sandboxMode, IGenericConfig configData)
73 { 75 {
@@ -167,7 +169,7 @@ namespace OpenSim
167 { 169 {
168 this.GridURL = attri; 170 this.GridURL = attri;
169 } 171 }
170 172
171 //Grid Send Key 173 //Grid Send Key
172 attri = ""; 174 attri = "";
173 attri = configData.GetAttribute("GridSendKey"); 175 attri = configData.GetAttribute("GridSendKey");
@@ -180,7 +182,7 @@ namespace OpenSim
180 { 182 {
181 this.GridSendKey = attri; 183 this.GridSendKey = attri;
182 } 184 }
183 185
184 //Grid Receive Key 186 //Grid Receive Key
185 attri = ""; 187 attri = "";
186 attri = configData.GetAttribute("GridRecvKey"); 188 attri = configData.GetAttribute("GridRecvKey");
@@ -192,12 +194,15 @@ namespace OpenSim
192 else 194 else
193 { 195 {
194 this.GridRecvKey = attri; 196 this.GridRecvKey = attri;
195 } 197 }
196 198
197 199
198 } 200 }
199 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); 201 this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
200 this.SaveToGrid(); 202 if (!this.isSandbox)
203 {
204 this.SaveToGrid();
205 }
201 configData.Commit(); 206 configData.Commit();
202 } 207 }
203 catch (Exception e) 208 catch (Exception e)