diff options
Diffstat (limited to 'OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs')
-rw-r--r-- | OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index 1687205..2634717 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | |||
@@ -25,6 +25,7 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
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<Session> sessionsToClient = new List<Session>(); | ||
28 | private readonly IList<MXPClientView> sessionsToRemove = new List<MXPClientView>(); | 29 | private readonly IList<MXPClientView> sessionsToRemove = new List<MXPClientView>(); |
29 | 30 | ||
30 | private readonly String cloudUrl; | 31 | private readonly String cloudUrl; |
@@ -217,24 +218,24 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
217 | { | 218 | { |
218 | if (transmitter.PendingSessionCount > 0) | 219 | if (transmitter.PendingSessionCount > 0) |
219 | { | 220 | { |
220 | sessions.Add(transmitter.AcceptPendingSession()); | 221 | Session tmp = transmitter.AcceptPendingSession(); |
222 | sessions.Add(tmp); | ||
223 | sessionsToClient.Add(tmp); | ||
224 | |||
221 | } | 225 | } |
222 | 226 | ||
223 | foreach (MXPClientView clientView in Clients) | 227 | List<Session> tmpRemove = new List<Session>(); |
224 | { | ||
225 | |||
226 | int messagesProcessedCount = 0; | ||
227 | Session session = clientView.Session; | ||
228 | 228 | ||
229 | foreach (Session session in sessionsToClient) | ||
230 | { | ||
229 | while (session.AvailableMessages > 0) | 231 | while (session.AvailableMessages > 0) |
230 | { | 232 | { |
231 | |||
232 | Message message = session.Receive(); | 233 | Message message = session.Receive(); |
233 | 234 | ||
234 | if (message.GetType() == typeof(JoinRequestMessage)) | 235 | if (message.GetType() == typeof (JoinRequestMessage)) |
235 | { | 236 | { |
236 | 237 | ||
237 | JoinRequestMessage joinRequestMessage = (JoinRequestMessage)message; | 238 | JoinRequestMessage joinRequestMessage = (JoinRequestMessage) message; |
238 | 239 | ||
239 | bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName, | 240 | bool authorized = AuthoriseUser(joinRequestMessage.ParticipantName, |
240 | joinRequestMessage.ParticipantPassphrase, | 241 | joinRequestMessage.ParticipantPassphrase, |
@@ -246,7 +247,9 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
246 | 247 | ||
247 | UUID mxpSessionID = UUID.Random(); | 248 | UUID mxpSessionID = UUID.Random(); |
248 | 249 | ||
249 | m_log.Info("[MXP ClientStack] Session join request success: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); | 250 | m_log.Info("[MXP ClientStack] Session join request success: " + session.SessionId + " (" + |
251 | (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + | ||
252 | session.RemoteEndPoint.Port + ")"); | ||
250 | 253 | ||
251 | AcceptConnection(session, joinRequestMessage, mxpSessionID); | 254 | AcceptConnection(session, joinRequestMessage, mxpSessionID); |
252 | 255 | ||
@@ -258,12 +261,33 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
258 | } | 261 | } |
259 | else | 262 | else |
260 | { | 263 | { |
261 | m_log.Info("[MXP ClientStack] Session join request failure: " + session.SessionId + " (" + (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + session.RemoteEndPoint.Port + ")"); | 264 | m_log.Info("[MXP ClientStack] Session join request failure: " + session.SessionId + " (" + |
265 | (session.IsIncoming ? "from" : "to") + " " + session.RemoteEndPoint.Address + ":" + | ||
266 | session.RemoteEndPoint.Port + ")"); | ||
262 | 267 | ||
263 | DeclineConnection(session, joinRequestMessage); | 268 | DeclineConnection(session, joinRequestMessage); |
264 | } | 269 | } |
265 | 270 | ||
271 | tmpRemove.Add(session); | ||
266 | } | 272 | } |
273 | } | ||
274 | } | ||
275 | |||
276 | foreach (Session session in tmpRemove) | ||
277 | { | ||
278 | sessionsToClient.Remove(session); | ||
279 | } | ||
280 | |||
281 | foreach (MXPClientView clientView in Clients) | ||
282 | { | ||
283 | |||
284 | int messagesProcessedCount = 0; | ||
285 | Session session = clientView.Session; | ||
286 | |||
287 | while (session.AvailableMessages > 0) | ||
288 | { | ||
289 | Message message = session.Receive(); | ||
290 | |||
267 | if (message.GetType() == typeof(LeaveRequestMessage)) | 291 | if (message.GetType() == typeof(LeaveRequestMessage)) |
268 | { | 292 | { |
269 | 293 | ||