diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | 736 |
1 files changed, 368 insertions, 368 deletions
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index 9f635fd..1687205 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | |||
@@ -1,368 +1,368 @@ | |||
1 | /* This file borrows heavily from MXPServer.cs - the reference MXPServer | 1 | /* This file borrows heavily from MXPServer.cs - the reference MXPServer |
2 | * See http://www.bubblecloud.org for a copy of the original file and | 2 | * See http://www.bubblecloud.org for a copy of the original file and |
3 | * implementation details. */ | 3 | * implementation details. */ |
4 | using System; | 4 | using System; |
5 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Reflection; | 6 | using System.Reflection; |
7 | using log4net; | 7 | using log4net; |
8 | using MXP; | 8 | using MXP; |
9 | using MXP.Messages; | 9 | using MXP.Messages; |
10 | using OpenMetaverse; | 10 | using OpenMetaverse; |
11 | using OpenSim.Client.MXP.ClientStack; | 11 | using OpenSim.Client.MXP.ClientStack; |
12 | using OpenSim.Region.Framework.Scenes; | 12 | using OpenSim.Region.Framework.Scenes; |
13 | 13 | ||
14 | namespace OpenSim.Client.MXP.PacketHandler | 14 | namespace OpenSim.Client.MXP.PacketHandler |
15 | { | 15 | { |
16 | class MXPPacketServer | 16 | class MXPPacketServer |
17 | { | 17 | { |
18 | internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 18 | internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
19 | 19 | ||
20 | private readonly List<MXPClientView> Clients = new List<MXPClientView>(); | 20 | private readonly List<MXPClientView> Clients = new List<MXPClientView>(); |
21 | private readonly Dictionary<UUID, Scene> Scenes; | 21 | private readonly Dictionary<UUID, Scene> Scenes; |
22 | 22 | ||
23 | #region Fields | 23 | #region Fields |
24 | 24 | ||
25 | private readonly Transmitter transmitter; | 25 | private readonly Transmitter transmitter; |
26 | 26 | ||
27 | private readonly IList<Session> sessions = new List<Session>(); | 27 | private readonly IList<Session> sessions = new List<Session>(); |
28 | private readonly IList<MXPClientView> sessionsToRemove = new List<MXPClientView>(); | 28 | private readonly IList<MXPClientView> sessionsToRemove = new List<MXPClientView>(); |
29 | 29 | ||
30 | private readonly String cloudUrl; | 30 | private readonly String cloudUrl; |
31 | private readonly String programName; | 31 | private readonly String programName; |
32 | private readonly byte programMajorVersion; | 32 | private readonly byte programMajorVersion; |
33 | private readonly byte programMinorVersion; | 33 | private readonly byte programMinorVersion; |
34 | 34 | ||
35 | #endregion | 35 | #endregion |
36 | 36 | ||
37 | #region Constructors | 37 | #region Constructors |
38 | 38 | ||
39 | public MXPPacketServer(string cloudUrl, int port, Dictionary<UUID, Scene> scenes) | 39 | public MXPPacketServer(string cloudUrl, int port, Dictionary<UUID, Scene> scenes) |
40 | { | 40 | { |
41 | this.cloudUrl = cloudUrl; | 41 | this.cloudUrl = cloudUrl; |
42 | 42 | ||
43 | Scenes = scenes; | 43 | Scenes = scenes; |
44 | 44 | ||
45 | programMinorVersion = 63; | 45 | programMinorVersion = 63; |
46 | programMajorVersion = 0; | 46 | programMajorVersion = 0; |
47 | programName = "OpenSimulator"; | 47 | programName = "OpenSimulator"; |
48 | 48 | ||
49 | transmitter = new Transmitter(port); | 49 | transmitter = new Transmitter(port); |
50 | transmitter.Startup(); | 50 | transmitter.Startup(); |
51 | } | 51 | } |
52 | 52 | ||
53 | #endregion | 53 | #endregion |
54 | 54 | ||
55 | #region Properties | 55 | #region Properties |
56 | 56 | ||
57 | /// <summary> | 57 | /// <summary> |
58 | /// Number of sessions pending. (Process() accepts pending sessions). | 58 | /// Number of sessions pending. (Process() accepts pending sessions). |
59 | /// </summary> | 59 | /// </summary> |
60 | public int PendingSessionCount | 60 | public int PendingSessionCount |
61 | { | 61 | { |
62 | get | 62 | get |
63 | { | 63 | { |
64 | return transmitter.PendingSessionCount; | 64 | return transmitter.PendingSessionCount; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | /// <summary> | 67 | /// <summary> |
68 | /// Number of connected sessions. | 68 | /// Number of connected sessions. |
69 | /// </summary> | 69 | /// </summary> |
70 | public int SessionCount | 70 | public int SessionCount |
71 | { | 71 | { |
72 | get | 72 | get |
73 | { | 73 | { |
74 | return sessions.Count; | 74 | return sessions.Count; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | /// <summary> | 77 | /// <summary> |
78 | /// Property reflecting whether client transmitter threads are alive. | 78 | /// Property reflecting whether client transmitter threads are alive. |
79 | /// </summary> | 79 | /// </summary> |
80 | public bool IsTransmitterAlive | 80 | public bool IsTransmitterAlive |
81 | { | 81 | { |
82 | get | 82 | get |
83 | { | 83 | { |
84 | return transmitter != null && transmitter.IsAlive; | 84 | return transmitter != null && transmitter.IsAlive; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | /// <summary> | 87 | /// <summary> |
88 | /// Number of packets sent. | 88 | /// Number of packets sent. |
89 | /// </summary> | 89 | /// </summary> |
90 | public ulong PacketsSent | 90 | public ulong PacketsSent |
91 | { | 91 | { |
92 | get | 92 | get |
93 | { | 93 | { |
94 | return transmitter != null ? transmitter.PacketsSent : 0; | 94 | return transmitter != null ? transmitter.PacketsSent : 0; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | /// <summary> | 97 | /// <summary> |
98 | /// Number of packets received. | 98 | /// Number of packets received. |
99 | /// </summary> | 99 | /// </summary> |
100 | public ulong PacketsReceived | 100 | public ulong PacketsReceived |
101 | { | 101 | { |
102 | get | 102 | get |
103 | { | 103 | { |
104 | return transmitter != null ? transmitter.PacketsReceived : 0; | 104 | return transmitter != null ? transmitter.PacketsReceived : 0; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | /// <summary> | 107 | /// <summary> |
108 | /// Bytes client has received so far. | 108 | /// Bytes client has received so far. |
109 | /// </summary> | 109 | /// </summary> |
110 | public ulong BytesReceived | 110 | public ulong BytesReceived |
111 | { | 111 | { |
112 | get | 112 | get |
113 | { | 113 | { |
114 | return transmitter != null ? transmitter.BytesReceived : 0; | 114 | return transmitter != null ? transmitter.BytesReceived : 0; |
115 | } | 115 | } |
116 | } | 116 | } |
117 | /// <summary> | 117 | /// <summary> |
118 | /// Bytes client has sent so far. | 118 | /// Bytes client has sent so far. |
119 | /// </summary> | 119 | /// </summary> |
120 | public ulong BytesSent | 120 | public ulong BytesSent |
121 | { | 121 | { |
122 | get | 122 | get |
123 | { | 123 | { |
124 | return transmitter != null ? transmitter.BytesSent : 0; | 124 | return transmitter != null ? transmitter.BytesSent : 0; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | /// <summary> | 127 | /// <summary> |
128 | /// Number of bytes received (bytes per second) during past second. | 128 | /// Number of bytes received (bytes per second) during past second. |
129 | /// </summary> | 129 | /// </summary> |
130 | public double ReceiveRate | 130 | public double ReceiveRate |
131 | { | 131 | { |
132 | get | 132 | get |
133 | { | 133 | { |
134 | return transmitter != null ? transmitter.ReceiveRate : 0; | 134 | return transmitter != null ? transmitter.ReceiveRate : 0; |
135 | } | 135 | } |
136 | } | 136 | } |
137 | /// <summary> | 137 | /// <summary> |
138 | /// Number of bytes sent (bytes per second) during past second. | 138 | /// Number of bytes sent (bytes per second) during past second. |
139 | /// </summary> | 139 | /// </summary> |
140 | public double SendRate | 140 | public double SendRate |
141 | { | 141 | { |
142 | get | 142 | get |
143 | { | 143 | { |
144 | return transmitter != null ? transmitter.SendRate : 0; | 144 | return transmitter != null ? transmitter.SendRate : 0; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | #endregion | 148 | #endregion |
149 | 149 | ||
150 | #region Session Management | 150 | #region Session Management |
151 | 151 | ||
152 | public void Disconnect(Session session) | 152 | public void Disconnect(Session session) |
153 | { | 153 | { |
154 | if (session.IsConnected) | 154 | if (session.IsConnected) |
155 | { | 155 | { |
156 | Message message = MessageFactory.Current.ReserveMessage(typeof(LeaveRequestMessage)); | 156 | Message message = MessageFactory.Current.ReserveMessage(typeof(LeaveRequestMessage)); |
157 | session.Send(message); | 157 | session.Send(message); |
158 | MessageFactory.Current.ReleaseMessage(message); | 158 | MessageFactory.Current.ReleaseMessage(message); |
159 | } | 159 | } |
160 | else | 160 | else |
161 | { | 161 | { |
162 | throw new Exception("Not connected."); | 162 | throw new Exception("Not connected."); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | #endregion | 166 | #endregion |
167 | 167 | ||
168 | 168 | ||
169 | #region Processing | 169 | #region Processing |
170 | 170 | ||
171 | public void PrintDebugInformation() | 171 | public void PrintDebugInformation() |
172 | { | 172 | { |
173 | m_log.Info("[MXP ClientStack] Statistics report"); | 173 | m_log.Info("[MXP ClientStack] Statistics report"); |
174 | m_log.Info("Pending Sessions: " + PendingSessionCount); | 174 | m_log.Info("Pending Sessions: " + PendingSessionCount); |
175 | m_log.Info("Sessions: " + SessionCount + " (Clients: " + Clients.Count + " )"); | 175 | m_log.Info("Sessions: " + SessionCount + " (Clients: " + Clients.Count + " )"); |
176 | m_log.Info("Transmitter Alive?: " + IsTransmitterAlive); | 176 | m_log.Info("Transmitter Alive?: " + IsTransmitterAlive); |
177 | m_log.Info("Packets Sent/Recieved: " + PacketsSent + " / " + PacketsReceived); | 177 | m_log.Info("Packets Sent/Recieved: " + PacketsSent + " / " + PacketsReceived); |
178 | m_log.Info("Bytes Sent/Recieved: " + BytesSent + " / " + BytesReceived); | 178 | m_log.Info("Bytes Sent/Recieved: " + BytesSent + " / " + BytesReceived); |
179 | m_log.Info("Send/Recieve Rate (bps): " + SendRate + " / " + ReceiveRate); | 179 | m_log.Info("Send/Recieve Rate (bps): " + SendRate + " / " + ReceiveRate); |
180 | } | 180 | } |
181 | 181 | ||
182 | public void Process() | 182 | public void Process() |
183 | { | 183 | { |
184 | ProcessMessages(); | 184 | ProcessMessages(); |
185 | Clean(); | 185 | Clean(); |
186 | } | 186 | } |
187 | 187 | ||
188 | public void Clean() | 188 | public void Clean() |
189 | { | 189 | { |
190 | foreach (MXPClientView clientView in Clients) | 190 | foreach (MXPClientView clientView in Clients) |
191 | { | 191 | { |
192 | if (clientView.Session.SessionState == SessionState.Disconnected) | 192 | if (clientView.Session.SessionState == SessionState.Disconnected) |
193 | { | 193 | { |
194 | sessionsToRemove.Add(clientView); | 194 | sessionsToRemove.Add(clientView); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | foreach (MXPClientView clientView in sessionsToRemove) | 198 | foreach (MXPClientView clientView in sessionsToRemove) |
199 | { | 199 | { |
200 | clientView.Scene.RemoveClient(clientView.AgentId); | 200 | clientView.Scene.RemoveClient(clientView.AgentId); |
201 | Clients.Remove(clientView); | 201 | Clients.Remove(clientView); |
202 | sessions.Remove(clientView.Session); | 202 | sessions.Remove(clientView.Session); |
203 | } | 203 | } |
204 | 204 | ||
205 | sessionsToRemove.Clear(); | 205 | sessionsToRemove.Clear(); |
206 | } | 206 | } |
207 | 207 | ||
208 | public bool AuthoriseUser(string participantName, string pass, UUID scene) | 208 | public bool AuthoriseUser(string participantName, string pass, UUID scene) |
209 | { | 209 | { |
210 | if (Scenes.ContainsKey(scene)) | 210 | if (Scenes.ContainsKey(scene)) |
211 | return true; | 211 | return true; |
212 | 212 | ||
213 | return false; | 213 | return false; |
214 | } | 214 | } |
215 | 215 | ||
216 | public void ProcessMessages() | 216 | public void ProcessMessages() |
217 | { | 217 | { |
218 | if (transmitter.PendingSessionCount > 0) | 218 | if (transmitter.PendingSessionCount > 0) |
219 | { | 219 | { |
220 | sessions.Add(transmitter.AcceptPendingSession()); | 220 | sessions.Add(transmitter.AcceptPendingSession()); |
221 | } | 221 | } |
222 | 222 | ||
223 | foreach (MXPClientView clientView in Clients) | 223 | foreach (MXPClientView clientView in Clients) |
224 | { | 224 | { |
225 | 225 | ||
226 | int messagesProcessedCount = 0; | 226 | int messagesProcessedCount = 0; |
227 | Session session = clientView.Session; | 227 | Session session = clientView.Session; |
228 | 228 | ||
229 | while (session.AvailableMessages > 0) | 229 | while (session.AvailableMessages > 0) |
230 | { | 230 | { |
231 | 231 | ||
232 | Message message = session.Receive(); | 232 | Message message = session.Receive(); |
233 | 233 | ||
234 | if (message.GetType() == typeof(JoinRequestMessage)) | 234 | if (message.GetType() == typeof(JoinRequestMessage)) |
235 | { | 235 | { |
236 | 236 | ||
237 | JoinRequestMessage joinRequestMessage = (JoinRequestMessage)message; | 237 | JoinRequestMessage joinRequestMessage = (JoinRequestMessage)message; |
238 | 238 | ||
239 | bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName, | 239 | bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName, |
240 | joinRequestMessage.ParticipantPassphrase, | 240 | joinRequestMessage.ParticipantPassphrase, |
241 | new UUID(joinRequestMessage.BubbleId)); | 241 | new UUID(joinRequestMessage.BubbleId)); |
242 | 242 | ||
243 | if (authorized) | 243 | if (authorized) |
244 | { | 244 | { |
245 | Scene target = Scenes[new UUID(joinRequestMessage.BubbleId)]; | 245 | Scene target = Scenes[new UUID(joinRequestMessage.BubbleId)]; |
246 | 246 | ||
247 | UUID mxpSessionID = UUID.Random(); | 247 | UUID mxpSessionID = UUID.Random(); |
248 | 248 | ||
249 | m_log.Info("[MXP ClientStack] Session join request success: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); | 249 | m_log.Info("[MXP ClientStack] Session join request success: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); |
250 | 250 | ||
251 | AcceptConnection(session, joinRequestMessage, mxpSessionID); | 251 | AcceptConnection(session, joinRequestMessage, mxpSessionID); |
252 | 252 | ||
253 | MXPClientView client = new MXPClientView(session, mxpSessionID, target, | 253 | MXPClientView client = new MXPClientView(session, mxpSessionID, target, |
254 | joinRequestMessage.ParticipantName); | 254 | joinRequestMessage.ParticipantName); |
255 | Clients.Add(client); | 255 | Clients.Add(client); |
256 | 256 | ||
257 | target.AddNewClient(client); | 257 | target.AddNewClient(client); |
258 | } | 258 | } |
259 | else | 259 | else |
260 | { | 260 | { |
261 | m_log.Info("[MXP ClientStack] Session join request failure: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); | 261 | m_log.Info("[MXP ClientStack] Session join request failure: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); |
262 | 262 | ||
263 | DeclineConnection(session, joinRequestMessage); | 263 | DeclineConnection(session, joinRequestMessage); |
264 | } | 264 | } |
265 | 265 | ||
266 | } | 266 | } |
267 | if (message.GetType() == typeof(LeaveRequestMessage)) | 267 | if (message.GetType() == typeof(LeaveRequestMessage)) |
268 | { | 268 | { |
269 | 269 | ||
270 | LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)MessageFactory.Current.ReserveMessage( | 270 | LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)MessageFactory.Current.ReserveMessage( |
271 | typeof(LeaveResponseMessage)); | 271 | typeof(LeaveResponseMessage)); |
272 | 272 | ||
273 | m_log.Info("[MXP ClientStack] Session leave request: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); | 273 | m_log.Info("[MXP ClientStack] Session leave request: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); |
274 | 274 | ||
275 | leaveResponseMessage.RequestMessageId = message.MessageId; | 275 | leaveResponseMessage.RequestMessageId = message.MessageId; |
276 | leaveResponseMessage.FailureCode = 0; | 276 | leaveResponseMessage.FailureCode = 0; |
277 | session.Send(leaveResponseMessage); | 277 | session.Send(leaveResponseMessage); |
278 | 278 | ||
279 | if (session.SessionState != SessionState.Disconnected) | 279 | if (session.SessionState != SessionState.Disconnected) |
280 | { | 280 | { |
281 | session.SetStateDisconnected(); | 281 | session.SetStateDisconnected(); |
282 | } | 282 | } |
283 | 283 | ||
284 | m_log.Info("[MXP ClientStack] Removing Client from Scene"); | 284 | m_log.Info("[MXP ClientStack] Removing Client from Scene"); |
285 | clientView.Scene.RemoveClient(clientView.AgentId); | 285 | clientView.Scene.RemoveClient(clientView.AgentId); |
286 | } | 286 | } |
287 | if (message.GetType() == typeof(LeaveResponseMessage)) | 287 | if (message.GetType() == typeof(LeaveResponseMessage)) |
288 | { | 288 | { |
289 | 289 | ||
290 | LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)message; | 290 | LeaveResponseMessage leaveResponseMessage = (LeaveResponseMessage)message; |
291 | 291 | ||
292 | m_log.Info("[MXP ClientStack] Session leave response: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); | 292 | m_log.Info("[MXP ClientStack] Session leave response: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); |
293 | 293 | ||
294 | if (leaveResponseMessage.FailureCode == 0) | 294 | if (leaveResponseMessage.FailureCode == 0) |
295 | { | 295 | { |
296 | session.SetStateDisconnected(); | 296 | session.SetStateDisconnected(); |
297 | } | 297 | } |
298 | 298 | ||
299 | m_log.Info("[MXP ClientStack] Removing Client from Scene"); | 299 | m_log.Info("[MXP ClientStack] Removing Client from Scene"); |
300 | clientView.Scene.RemoveClient(clientView.AgentId); | 300 | clientView.Scene.RemoveClient(clientView.AgentId); |
301 | } | 301 | } |
302 | else | 302 | else |
303 | { | 303 | { |
304 | clientView.ProcessMXPPacket(message); | 304 | clientView.ProcessMXPPacket(message); |
305 | } | 305 | } |
306 | 306 | ||
307 | MessageFactory.Current.ReleaseMessage(message); | 307 | MessageFactory.Current.ReleaseMessage(message); |
308 | messagesProcessedCount++; | 308 | messagesProcessedCount++; |
309 | if (messagesProcessedCount > 1000) | 309 | if (messagesProcessedCount > 1000) |
310 | { | 310 | { |
311 | break; | 311 | break; |
312 | } | 312 | } |
313 | } | 313 | } |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | private void AcceptConnection(Session session, JoinRequestMessage joinRequestMessage, UUID mxpSessionID) | 317 | private void AcceptConnection(Session session, JoinRequestMessage joinRequestMessage, UUID mxpSessionID) |
318 | { | 318 | { |
319 | JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage( | 319 | JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage( |
320 | typeof(JoinResponseMessage)); | 320 | typeof(JoinResponseMessage)); |
321 | 321 | ||
322 | joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId; | 322 | joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId; |
323 | joinResponseMessage.FailureCode = 0; | 323 | joinResponseMessage.FailureCode = 0; |
324 | 324 | ||
325 | joinResponseMessage.ParticipantId = mxpSessionID.Guid; | 325 | joinResponseMessage.ParticipantId = mxpSessionID.Guid; |
326 | joinResponseMessage.CloudUrl = cloudUrl; | 326 | joinResponseMessage.CloudUrl = cloudUrl; |
327 | 327 | ||
328 | joinResponseMessage.BubbleName = Scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName; | 328 | joinResponseMessage.BubbleName = Scenes[new UUID(joinRequestMessage.BubbleId)].RegionInfo.RegionName; |
329 | 329 | ||
330 | joinResponseMessage.BubbleRealTime = 0; | 330 | joinResponseMessage.BubbleRealTime = 0; |
331 | joinResponseMessage.ProgramName = programName; | 331 | joinResponseMessage.ProgramName = programName; |
332 | joinResponseMessage.ProgramMajorVersion = programMajorVersion; | 332 | joinResponseMessage.ProgramMajorVersion = programMajorVersion; |
333 | joinResponseMessage.ProgramMinorVersion = programMinorVersion; | 333 | joinResponseMessage.ProgramMinorVersion = programMinorVersion; |
334 | joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion; | 334 | joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion; |
335 | joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion; | 335 | joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion; |
336 | 336 | ||
337 | session.Send(joinResponseMessage); | 337 | session.Send(joinResponseMessage); |
338 | 338 | ||
339 | session.SetStateConnected(); | 339 | session.SetStateConnected(); |
340 | } | 340 | } |
341 | 341 | ||
342 | private void DeclineConnection(Session session, Message joinRequestMessage) | 342 | private void DeclineConnection(Session session, Message joinRequestMessage) |
343 | { | 343 | { |
344 | JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(typeof(JoinResponseMessage)); | 344 | JoinResponseMessage joinResponseMessage = (JoinResponseMessage)MessageFactory.Current.ReserveMessage(typeof(JoinResponseMessage)); |
345 | 345 | ||
346 | joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId; | 346 | joinResponseMessage.RequestMessageId = joinRequestMessage.MessageId; |
347 | joinResponseMessage.FailureCode = 1; | 347 | joinResponseMessage.FailureCode = 1; |
348 | 348 | ||
349 | joinResponseMessage.CloudUrl = cloudUrl; | 349 | joinResponseMessage.CloudUrl = cloudUrl; |
350 | 350 | ||
351 | joinResponseMessage.BubbleName = "Declined OpenSim Region"; // Dont reveal anything about the sim in the disconnect notice | 351 | joinResponseMessage.BubbleName = "Declined OpenSim Region"; // Dont reveal anything about the sim in the disconnect notice |
352 | 352 | ||
353 | joinResponseMessage.BubbleRealTime = 0; | 353 | joinResponseMessage.BubbleRealTime = 0; |
354 | joinResponseMessage.ProgramName = programName; | 354 | joinResponseMessage.ProgramName = programName; |
355 | joinResponseMessage.ProgramMajorVersion = programMajorVersion; | 355 | joinResponseMessage.ProgramMajorVersion = programMajorVersion; |
356 | joinResponseMessage.ProgramMinorVersion = programMinorVersion; | 356 | joinResponseMessage.ProgramMinorVersion = programMinorVersion; |
357 | joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion; | 357 | joinResponseMessage.ProtocolMajorVersion = MxpConstants.ProtocolMajorVersion; |
358 | joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion; | 358 | joinResponseMessage.ProtocolMinorVersion = MxpConstants.ProtocolMinorVersion; |
359 | 359 | ||
360 | session.Send(joinResponseMessage); | 360 | session.Send(joinResponseMessage); |
361 | 361 | ||
362 | session.SetStateDisconnected(); | 362 | session.SetStateDisconnected(); |
363 | } | 363 | } |
364 | 364 | ||
365 | #endregion | 365 | #endregion |
366 | 366 | ||
367 | } | 367 | } |
368 | } | 368 | } |