Stop HTTP Listener on process exit

This commit is contained in:
Zontreck 2020-06-21 01:23:16 -07:00
parent 4560844383
commit 26bd15fa27

View file

@ -86,10 +86,17 @@ namespace Bot.WebHookServer
listener.BeginGetContext(hc.OnWebHook, null);
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
}catch(Exception e)
{
BotSession.Instance.MHE(MessageHandler.Destinations.DEST_LOCAL, UUID.Zero, "Error: Program could not escalate to Admin Privileges. WebHook engine not running\n\n"+e.Message+"\n"+e.StackTrace);
}
}
private void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
listener.Stop();
}
}
}