[BF] When using Dispose, kill also mqtt connection

This commit is contained in:
BlubbFish 2019-08-02 19:03:25 +02:00
parent 1b0fb91b08
commit 03849c999a

View File

@ -28,7 +28,7 @@ namespace BlubbFish.Utils.IoT.Bots {
this.httplistener = new HttpListener();
this.httplistener.Prefixes.Add(this.config["prefix"]);
this.httplistener.Start();
ThreadPool.QueueUserWorkItem((o) => {
_ = ThreadPool.QueueUserWorkItem((o) => {
Console.WriteLine("Webserver is Running...");
try {
while(this.httplistener.IsListening) {
@ -147,6 +147,9 @@ namespace BlubbFish.Utils.IoT.Bots {
public override void Dispose() {
this.httplistener.Stop();
this.httplistener.Close();
if(this.databackend != null) {
this.databackend.Dispose();
}
base.Dispose();
}