aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer/MessageServersConnector.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-26 08:31:00 +0000
committerTeravus Ovares2008-02-26 08:31:00 +0000
commitcb828c98242bf11294a9b085d8f186e37f1239e0 (patch)
tree6d366fdf39e21be2273efd009018812619c84aa1 /OpenSim/Grid/UserServer/MessageServersConnector.cs
parent* Start sending "ImageNotFound" packet back to the client if we can't find an... (diff)
downloadopensim-SC_OLD-cb828c98242bf11294a9b085d8f186e37f1239e0.zip
opensim-SC_OLD-cb828c98242bf11294a9b085d8f186e37f1239e0.tar.gz
opensim-SC_OLD-cb828c98242bf11294a9b085d8f186e37f1239e0.tar.bz2
opensim-SC_OLD-cb828c98242bf11294a9b085d8f186e37f1239e0.tar.xz
* More Message server stuff. Still not ready.
Diffstat (limited to 'OpenSim/Grid/UserServer/MessageServersConnector.cs')
-rw-r--r--OpenSim/Grid/UserServer/MessageServersConnector.cs97
1 files changed, 84 insertions, 13 deletions
diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs
index 6535247..79d1147 100644
--- a/OpenSim/Grid/UserServer/MessageServersConnector.cs
+++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs
@@ -52,12 +52,20 @@ namespace OpenSim.Grid.UserServer
52 52
53 public void RegisterMessageServer(string URI, MessageServerInfo serverData) 53 public void RegisterMessageServer(string URI, MessageServerInfo serverData)
54 { 54 {
55 MessageServers.Add(URI, serverData); 55 lock (MessageServers)
56 {
57 if (!MessageServers.ContainsKey(URI))
58 MessageServers.Add(URI, serverData);
59 }
56 } 60 }
57 61
58 public void DeRegisterMessageServer(string URI) 62 public void DeRegisterMessageServer(string URI)
59 { 63 {
60 MessageServers.Remove(URI); 64 lock (MessageServers)
65 {
66 if (MessageServers.ContainsKey(URI))
67 MessageServers.Remove(URI);
68 }
61 } 69 }
62 70
63 public void AddResponsibleRegion(string URI, ulong regionhandle) 71 public void AddResponsibleRegion(string URI, ulong regionhandle)
@@ -150,24 +158,73 @@ namespace OpenSim.Grid.UserServer
150 return response; 158 return response;
151 } 159 }
152 160
153 public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) 161 public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
162 ulong regionhandle, float positionX, float positionY,
163 float positionZ, string firstname, string lastname)
154 { 164 {
155 // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D ) 165 // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D )
156 if (MessageServers.Count > 0) 166 lock (MessageServers)
157 { 167 {
158 m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers"); 168 if (MessageServers.Count > 0)
169 {
170 m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers");
171 }
172 else
173 {
174 m_log.Info("[MSGCONNECTOR]: No Message Servers registered, ignoring");
175 }
176 foreach (MessageServerInfo serv in MessageServers.Values)
177 {
178 NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID,
179 regionhandle, positionX, positionY, positionZ,
180 firstname, lastname);
181 }
159 } 182 }
160 else 183 }
184
185 public void TellMessageServersAboutUserLogoff(LLUUID agentID)
186 {
187 lock (MessageServers)
188 {
189 if (MessageServers.Count > 0)
190 {
191 m_log.Info("[MSGCONNECTOR]: Sending login notice to registered message servers");
192 }
193 else
194 {
195 m_log.Info("[MSGCONNECTOR]: No Message Servers registered, ignoring");
196 }
197 foreach (MessageServerInfo serv in MessageServers.Values)
198 {
199 NotifyMessageServerAboutUserLogoff(serv,agentID);
200 }
201 }
202 }
203
204 private void NotifyMessageServerAboutUserLogoff(MessageServerInfo serv, LLUUID agentID)
205 {
206 Hashtable reqparams = new Hashtable();
207 reqparams["sendkey"] = serv.sendkey;
208 reqparams["agentid"] = agentID.ToString();
209 ArrayList SendParams = new ArrayList();
210 SendParams.Add(reqparams);
211
212 XmlRpcRequest GridReq = new XmlRpcRequest("logout_of_simulator", SendParams);
213 try
161 { 214 {
162 m_log.Info("[MSGCONNECTOR]: No Message Servers registered, ignoring"); 215 XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000);
163 } 216 }
164 foreach (MessageServerInfo serv in MessageServers.Values) 217 catch (System.Net.WebException)
165 { 218 {
166 NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, regionhandle, Position); 219 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about log out. Other users might still think this user is online");
167 } 220 }
221 m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout");
168 } 222 }
169 223
170 private void NotifyMessageServerAboutUser(MessageServerInfo serv, LLUUID agentID, LLUUID sessionID, LLUUID RegionID, ulong regionhandle, LLVector3 Position) 224 private void NotifyMessageServerAboutUser(MessageServerInfo serv,
225 LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
226 ulong regionhandle, float positionX, float positionY, float positionZ,
227 string firstname, string lastname)
171 { 228 {
172 Hashtable reqparams = new Hashtable(); 229 Hashtable reqparams = new Hashtable();
173 reqparams["sendkey"] = serv.sendkey; 230 reqparams["sendkey"] = serv.sendkey;
@@ -175,14 +232,28 @@ namespace OpenSim.Grid.UserServer
175 reqparams["sessionid"] = sessionID.ToString(); 232 reqparams["sessionid"] = sessionID.ToString();
176 reqparams["regionid"] = RegionID.ToString(); 233 reqparams["regionid"] = RegionID.ToString();
177 reqparams["regionhandle"] = regionhandle.ToString(); 234 reqparams["regionhandle"] = regionhandle.ToString();
178 reqparams["position"] = Position.ToString(); 235 reqparams["positionx"] = positionX.ToString();
236 reqparams["positiony"] = positionY.ToString();
237 reqparams["positionz"] = positionZ.ToString();
238 reqparams["firstname"] = firstname;
239 reqparams["lastname"] = lastname;
240
241 //reqparams["position"] = Position.ToString();
179 242
180 ArrayList SendParams = new ArrayList(); 243 ArrayList SendParams = new ArrayList();
181 SendParams.Add(reqparams); 244 SendParams.Add(reqparams);
182 245
183 XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams); 246 XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams);
184 XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000); 247 try
185 m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login"); 248 {
249 XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000);
250 m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login");
251 }
252 catch (System.Net.WebException)
253 {
254 m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user");
255 }
256
186 } 257 }
187 } 258 }
188} 259}