Skip to content

Commit

Permalink
Fixing #225
Browse files Browse the repository at this point in the history
  • Loading branch information
darkl committed Jan 6, 2018
1 parent f7f71bb commit 9398c2b
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,53 @@ public void Result<TMessage>(IWampFormatter<TMessage> formatter, YieldOptions de
{
ResultDetails resultDetails = GetResultDetails(details);
this.Result(formatter, resultDetails);
UnregisterConnectionClosedIfNeeded(details);
}

public void Result<TMessage>(IWampFormatter<TMessage> formatter, YieldOptions details, TMessage[] arguments)
{
ResultDetails resultDetails = GetResultDetails(details);
this.Result(formatter, resultDetails, arguments);
UnregisterConnectionClosedIfNeeded(details);
}

public void Result<TMessage>(IWampFormatter<TMessage> formatter, YieldOptions details, TMessage[] arguments,
IDictionary<string, TMessage> argumentsKeywords)
{
ResultDetails resultDetails = GetResultDetails(details);
this.Result(formatter, resultDetails, arguments, argumentsKeywords);
UnregisterConnectionClosedIfNeeded(details);
}

private void UnregisterConnectionClosedIfNeeded(YieldOptions details)
{
if (details.Progress != true)
{
mMonitor.ConnectionClosed -= OnConnectionClosed;
}
}

public void Error<TResult>(IWampFormatter<TResult> formatter, TResult details, string error)
{
Caller.CallError(RequestId, details, error);
UnregisterConnectionClosed();
}

public void Error<TResult>(IWampFormatter<TResult> formatter, TResult details, string error, TResult[] arguments)
{
Caller.CallError(RequestId, details, error, arguments.Cast<object>().ToArray());
UnregisterConnectionClosed();
}

public void Error<TResult>(IWampFormatter<TResult> formatter, TResult details, string error, TResult[] arguments, TResult argumentsKeywords)
{
Caller.CallError(RequestId, details, error, arguments.Cast<object>().ToArray(), argumentsKeywords);
UnregisterConnectionClosed();
}

private void UnregisterConnectionClosed()
{
mMonitor.ConnectionClosed -= OnConnectionClosed;
}

public event EventHandler Disconnected;
Expand Down

0 comments on commit 9398c2b

Please sign in to comment.