aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBrian McBee2007-11-25 21:21:44 +0000
committerBrian McBee2007-11-25 21:21:44 +0000
commit35472b36663fba7528358daa65e029d41ecde206 (patch)
treeda3918b4217e738734f09445234e52d48da6f034
parentRez new prims ON the ground, not halfway buried. Mantis 33. (diff)
downloadopensim-SC-35472b36663fba7528358daa65e029d41ecde206.zip
opensim-SC-35472b36663fba7528358daa65e029d41ecde206.tar.gz
opensim-SC-35472b36663fba7528358daa65e029d41ecde206.tar.bz2
opensim-SC-35472b36663fba7528358daa65e029d41ecde206.tar.xz
Added new configuration item to User Server: X and Y of region to send user to if their logon region is down. Known good region, sort of.
-rw-r--r--OpenSim/Framework/UserConfig.cs12
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs185
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketQueue.cs3
3 files changed, 138 insertions, 62 deletions
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs
index fdb8f82..d4ee62f 100644
--- a/OpenSim/Framework/UserConfig.cs
+++ b/OpenSim/Framework/UserConfig.cs
@@ -42,6 +42,8 @@ namespace OpenSim.Framework
42 42
43 public static uint DefaultHttpPort = 8002; 43 public static uint DefaultHttpPort = 8002;
44 public uint HttpPort = DefaultHttpPort; 44 public uint HttpPort = DefaultHttpPort;
45 public uint DefaultX = 1000;
46 public uint DefaultY = 1000;
45 47
46 private ConfigurationMember configMember; 48 private ConfigurationMember configMember;
47 49
@@ -71,6 +73,10 @@ namespace OpenSim.Framework
71 73
72 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 74 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
73 "Http Listener port", DefaultHttpPort.ToString(), false); 75 "Http Listener port", DefaultHttpPort.ToString(), false);
76 configMember.addConfigurationOption("default_X", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
77 "Known good region X", "1000", false);
78 configMember.addConfigurationOption("default_Y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
79 "Known good region Y", "1000", false);
74 } 80 }
75 81
76 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 82 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -95,6 +101,12 @@ namespace OpenSim.Framework
95 case "http_port": 101 case "http_port":
96 HttpPort = (uint) configuration_result; 102 HttpPort = (uint) configuration_result;
97 break; 103 break;
104 case "default_X":
105 DefaultX = (uint)configuration_result;
106 break;
107 case "default_Y":
108 DefaultY = (uint)configuration_result;
109 break;
98 } 110 }
99 111
100 return true; 112 return true;
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index bbef4b2..0af5790 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -54,76 +54,139 @@ namespace OpenSim.Grid.UserServer
54 /// <param name="theUser">The user profile</param> 54 /// <param name="theUser">The user profile</param>
55 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) 55 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
56 { 56 {
57 // Load information from the gridserver 57 bool tryDefault = false;
58 System.Console.WriteLine("Load information from the gridserver");
58 RegionProfileData SimInfo = new RegionProfileData(); 59 RegionProfileData SimInfo = new RegionProfileData();
59 SimInfo =
60 SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL,
61 m_config.GridSendKey, m_config.GridRecvKey);
62
63 // Customise the response
64 // Home Location
65 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
66 (SimInfo.regionLocY*256).ToString() + "], " +
67 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
68 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
69 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
70 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
71
72 // Destination
73 MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
74 SimInfo.regionLocY);
75 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
76 response.SimPort = (Int32) SimInfo.serverPort;
77 response.RegionX = SimInfo.regionLocX;
78 response.RegionY = SimInfo.regionLocY;
79
80 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
81 string capsPath = Util.GetRandomCapsPath();
82 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
83
84 // Notify the target of an incoming user
85 MainLog.Instance.Verbose("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
86
87 // Prepare notification
88 Hashtable SimParams = new Hashtable();
89 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
90 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
91 SimParams["firstname"] = theUser.username;
92 SimParams["lastname"] = theUser.surname;
93 SimParams["agent_id"] = theUser.UUID.ToString();
94 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
95 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
96 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
97 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
98 SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
99 SimParams["caps_path"] = capsPath;
100 ArrayList SendParams = new ArrayList();
101 SendParams.Add(SimParams);
102
103 // Update agent with target sim
104 theUser.currentAgent.currentRegion = SimInfo.UUID;
105 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
106
107 MainLog.Instance.Verbose("Informing region --> " + SimInfo.httpServerURI);
108 // Send
109 try 60 try
110 { 61 {
62 SimInfo =
63 SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL,
64 m_config.GridSendKey, m_config.GridRecvKey);
65
66 // Customise the response
67 System.Console.WriteLine("Home Location");
68 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" +
69 (SimInfo.regionLocY * 256).ToString() + "], " +
70 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
71 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
72 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
73 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
74
75 // Destination
76 MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
77 SimInfo.regionLocY);
78 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
79 response.SimPort = (Int32)SimInfo.serverPort;
80 response.RegionX = SimInfo.regionLocX;
81 response.RegionY = SimInfo.regionLocY;
82
83 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
84 string capsPath = Util.GetRandomCapsPath();
85 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
86
87 // Notify the target of an incoming user
88 MainLog.Instance.Verbose("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
89
90 // Prepare notification
91 Hashtable SimParams = new Hashtable();
92 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
93 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
94 SimParams["firstname"] = theUser.username;
95 SimParams["lastname"] = theUser.surname;
96 SimParams["agent_id"] = theUser.UUID.ToString();
97 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
98 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
99 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
100 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
101 SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
102 SimParams["caps_path"] = capsPath;
103 ArrayList SendParams = new ArrayList();
104 SendParams.Add(SimParams);
105
106 // Update agent with target sim
107 theUser.currentAgent.currentRegion = SimInfo.UUID;
108 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
109
110 MainLog.Instance.Verbose("Informing region --> " + SimInfo.httpServerURI);
111 // Send
112
111 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 113 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
112 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 114 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
113 } 115 }
114 catch (WebException e) 116 catch (Exception e)
115 { 117 {
116 switch (e.Status) 118 tryDefault = true;
119 }
120 if(tryDefault)
121 {
122 // Send him to default region instead
123 // Load information from the gridserver
124
125 ulong defaultHandle = (((ulong)m_config.DefaultX * 256) << 32) | ((ulong) m_config.DefaultY * 256);
126 MainLog.Instance.Warn("Home region not available: sending to default region " + defaultHandle.ToString());
127 SimInfo = new RegionProfileData();
128 try
117 { 129 {
118 case WebExceptionStatus.Timeout: 130 SimInfo =
119 //TODO: Send him to nearby or default region instead 131 SimInfo.RequestSimProfileData(defaultHandle, m_config.GridServerURL,
120 MainLog.Instance.Verbose("Unable to connect to " + SimInfo.regionName + " (" + SimInfo.serverURI + 132 m_config.GridSendKey, m_config.GridRecvKey);
121 ")"); 133
122 break; 134 // Customise the response
123 135 System.Console.WriteLine("Home Location");
124 default: 136 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" +
125 throw; 137 (SimInfo.regionLocY * 256).ToString() + "], " +
138 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
139 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
140 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
141 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
142
143 // Destination
144 MainLog.Instance.Verbose("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
145 SimInfo.regionLocY);
146 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
147 response.SimPort = (Int32)SimInfo.serverPort;
148 response.RegionX = SimInfo.regionLocX;
149 response.RegionY = SimInfo.regionLocY;
150
151 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
152 string capsPath = Util.GetRandomCapsPath();
153 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
154
155 // Notify the target of an incoming user
156 MainLog.Instance.Verbose("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
157
158 // Update agent with target sim
159 theUser.currentAgent.currentRegion = SimInfo.UUID;
160 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
161
162 // Prepare notification
163 Hashtable SimParams = new Hashtable();
164 SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
165 SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
166 SimParams["firstname"] = theUser.username;
167 SimParams["lastname"] = theUser.surname;
168 SimParams["agent_id"] = theUser.UUID.ToString();
169 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
170 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
171 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
172 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
173 SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
174 SimParams["caps_path"] = capsPath;
175 ArrayList SendParams = new ArrayList();
176 SendParams.Add(SimParams);
177
178 MainLog.Instance.Verbose("Informing region --> " + SimInfo.httpServerURI);
179 // Send
180 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
181 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
126 } 182 }
183
184 catch (Exception e)
185 {
186 MainLog.Instance.Warn("Default region also not available");
187 MainLog.Instance.Verbose(e.ToString());
188 }
189
127 } 190 }
128 } 191 }
129 } 192 }
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
index 1904bfa..4ca7bd9 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketQueue.cs
@@ -166,11 +166,12 @@ namespace OpenSim.Region.ClientStack
166 //userEP); 166 //userEP);
167 } 167 }
168 } 168 }
169 catch (Exception) 169 catch (Exception e)
170 { 170 {
171 MainLog.Instance.Warn("client", 171 MainLog.Instance.Warn("client",
172 "ClientView.PacketQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + 172 "ClientView.PacketQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " +
173 userEP.ToString() + " - killing thread"); 173 userEP.ToString() + " - killing thread");
174 MainLog.Instance.Error(e.ToString());
174 KillThread(); 175 KillThread();
175 } 176 }
176 } 177 }