diff options
Diffstat (limited to 'samples/OpenIdOfflineProvider/HttpHost.cs')
-rw-r--r-- | samples/OpenIdOfflineProvider/HttpHost.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/samples/OpenIdOfflineProvider/HttpHost.cs b/samples/OpenIdOfflineProvider/HttpHost.cs index 390275a..a2558f4 100644 --- a/samples/OpenIdOfflineProvider/HttpHost.cs +++ b/samples/OpenIdOfflineProvider/HttpHost.cs @@ -121,14 +121,19 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { private void ProcessRequests() { Contract.Requires(this.listener != null); - try { - while (true) { + while (true) { + try { HttpListenerContext context = this.listener.GetContext(); this.handler(context); + } catch (HttpListenerException ex) { + if (this.listener.IsListening) { + App.Logger.Error("Unexpected exception.", ex); + } else { + // the listener is probably being shut down + App.Logger.Warn("HTTP listener is closing down.", ex); + break; + } } - } catch (HttpListenerException ex) { - // the listener is probably being shut down - App.Logger.Warn("HTTP listener is closing down.", ex); } } } |