Skip to content

Commit

Permalink
feat: Added safety when no event delivery method is present
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoTenPvP committed Dec 10, 2019
1 parent 0f777d1 commit 7f4b0ed
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Ruffles/Core/RuffleSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,24 @@ public class RuffleSocket

internal void PublishEvent(NetworkEvent @event)
{
bool delivered = false;

if (config.EnablePollEvents)
{
delivered = true;
userEventQueue.Enqueue(@event);
}

if (config.EnableCallbackEvents && OnNetworkEvent != null)
{
{
delivered = true;
OnNetworkEvent(@event);
}

if (!delivered)
{
if (Logging.CurrentLogLevel <= LogLevel.Error) Logging.LogError("Unable to deliver event. Make sure you have PollEvents enabled and/or CallbackEvents enabled with a registered handler");
}
}

// Separate connections and pending to prevent something like a slorris attack
Expand Down

0 comments on commit 7f4b0ed

Please sign in to comment.