Skip to content

Commit 8c0b091

Browse files
author
Stephen Hodgson
committed
Fixed Session removal from list ServerListTracker. Session class does not have good equality checking.
1 parent 9d05ac2 commit 8c0b091

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Assets/HoloToolkit/Sharing/Scripts/ServerSessionsTracker.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
using System;
77
using System.Collections.Generic;
8+
using System.Linq;
89
using HoloToolkit.Unity;
10+
using UnityEngine;
911

1012
namespace HoloToolkit.Sharing
1113
{
@@ -166,8 +168,14 @@ private void OnSessionAdded(Session newSession)
166168

167169
private void OnSessionClosed(Session session)
168170
{
169-
SessionClosed.RaiseEvent(session);
170-
Sessions.Remove(session);
171+
for (int i = 0; i < Sessions.Count; i++)
172+
{
173+
if (Sessions[i].GetName().ToString().Equals(session.GetName().ToString()))
174+
{
175+
SessionClosed.RaiseEvent(session);
176+
Sessions.Remove(session);
177+
}
178+
}
171179
}
172180

173181
private void OnServerDisconnected()

0 commit comments

Comments
 (0)