EventManager rewritten to support a push arch instead of an internal poll. Crash finally fixed!!! The dangers of threading.

This commit is contained in:
watsonb8
2019-07-15 12:14:38 -04:00
parent d78dce44f0
commit 00b39b1d84
6 changed files with 254 additions and 327 deletions

View File

@ -2,12 +2,9 @@ using System;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Linq;
using Google.Protobuf.WellKnownTypes;
using Aurora.Proto.Party;
using Aurora.Proto.General;
using Aurora.Proto.Events;
using Aurora.Models;
using Aurora.Services;
using Aurora.Services.EventManager;
namespace Aurora.RemoteImpl
{
@ -39,6 +36,8 @@ namespace Aurora.RemoteImpl
IpAddress = context.Host,
};
Console.WriteLine("SERVER - Client joined party: " + partyMember.Id);
_partyMembers.Add(partyMember);
BaseEvent e = new BaseEvent
@ -50,7 +49,7 @@ namespace Aurora.RemoteImpl
}
};
EventManager.Instance.PushEvent(e);
EventManager.Instance.FireEvent(e);
JoinPartyResponse response = new JoinPartyResponse() { Status = PartyJoinedStatusEnum.Connected, ClientId = partyMember.Id };
return Task.FromResult(response);
@ -71,7 +70,7 @@ namespace Aurora.RemoteImpl
}
};
EventManager.Instance.PushEvent(bv);
EventManager.Instance.FireEvent(bv);
LeavePartyResponse response = new LeavePartyResponse() { Status = PartyJoinedStatusEnum.Disconnected };
return Task.FromResult(response);