mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-22 09:57:20 +00:00
Added additional exception handling to the http server.
This commit is contained in:
parent
0bc6629e3a
commit
dcfa8ef3f9
@ -10,5 +10,5 @@
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("0.5.1.14")]
|
||||
[assembly: AssemblyInformationalVersion("0.5.1.14 Alpha")]
|
||||
[assembly: AssemblyVersion("0.5.1.15")]
|
||||
[assembly: AssemblyInformationalVersion("0.5.1.15 Alpha")]
|
@ -5,7 +5,7 @@
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
Copyright (C) 2012 Prince Samuel <prince.samuel@gmail.com>
|
||||
Copyright (C) 2012 Michael Möller <mmoeller@openhardwaremonitor.org>
|
||||
Copyright (C) 2012-2013 Michael Möller <mmoeller@openhardwaremonitor.org>
|
||||
|
||||
*/
|
||||
|
||||
@ -37,6 +37,7 @@ namespace OpenHardwareMonitor.Utilities {
|
||||
|
||||
try {
|
||||
listener = new HttpListener();
|
||||
listener.IgnoreWriteExceptions = true;
|
||||
} catch (PlatformNotSupportedException) {
|
||||
listener = null;
|
||||
}
|
||||
@ -156,10 +157,12 @@ namespace OpenHardwareMonitor.Utilities {
|
||||
while ((len = stream.Read(buffer, 0, buffer.Length)) > 0) {
|
||||
output.Write(buffer, 0, len);
|
||||
}
|
||||
output.Close();
|
||||
} catch (HttpListenerException) {
|
||||
output.Flush();
|
||||
output.Close();
|
||||
response.Close();
|
||||
} catch (HttpListenerException) {
|
||||
} catch (InvalidOperationException) {
|
||||
}
|
||||
response.Close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user