When we do the tests (imitate the connection failure) the disconnect event doesn't fire.
Here is the test code:
- Code: Select all
public void joinToRoom(string name, string roomType, Dictionary<string,string> dct)
{
MainClient.Multiplayer.CreateJoinRoom (name, roomType, true, dct, null,
delegate(Connection value) {
string n = name;
string r = roomType;
var info = new mdl_RoomInfo(value,roomType);
if (!roomConnections.ContainsKey(name))
{
roomConnections.Add(name,info);
if (roomOnConnect.ContainsKey(roomType))
roomOnConnect[roomType](n,info);
value.OnDisconnect += delegate(object sender, string message) {
Debug.Log("Room disconnect " + sender.ToString() + " " + message); // <-- Debug.Log() is never displayed
if (roomOnDisconnect.ContainsKey(roomType))
{
roomOnDisconnect[roomType](n,info);
roomConnections.Remove(name);
}
};
value.OnMessage += delegate(object sender, Message e) {
if (roomOnMessage.ContainsKey(roomType))
roomOnMessage[roomType](n,info,e);
};
} else {
value.Disconnect();
}
}, OnError);
}
Need help.