Skip to content

Commit

Permalink
Improved error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ddummy committed Jan 9, 2014
1 parent d595112 commit 81dd42c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Exchposer/ExchangeServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,28 +188,25 @@ public void StopStreamingNotifications()
{
restartTimer.Stop();

try
{
if (streamingSubscription != null)
if (streamingSubscription != null)
try
{
var tmpStreamingSubscription = streamingSubscription;
streamingSubscription = null;
tmpStreamingSubscription.Unsubscribe();
}
catch { }

if (subscriptionConnection != null)
if (subscriptionConnection != null)
try
{
if (subscriptionConnection.IsOpen)
subscriptionConnection.Close();
subscriptionConnection.Dispose();
subscriptionConnection = null;
Log(2, "Exchange subscription stopped");
}
}
catch (Exception ex)
{
Log(1, String.Format("Exchange subscription stopping error: {0}", ex.Message));
}
catch { }
}

public void RestartStreamingNotifications()
Expand Down Expand Up @@ -264,7 +261,7 @@ private void OnError(object sender, SubscriptionErrorEventArgs args)
if (streamingSubscription == null)
return;

Log(3, String.Format("Exchange subscription error: {0} Restartting subscribtion...", args.Exception.Message));
Log(20, String.Format("Exchange subscription error: {0} Restartting subscribtion...", args.Exception.Message));
RestartStreamingNotifications();
/*
try
Expand Down

0 comments on commit 81dd42c

Please sign in to comment.