[BF] When using Dispose, kill also mqtt connection
This commit is contained in:
parent
1b0fb91b08
commit
03849c999a
@ -28,7 +28,7 @@ namespace BlubbFish.Utils.IoT.Bots {
|
|||||||
this.httplistener = new HttpListener();
|
this.httplistener = new HttpListener();
|
||||||
this.httplistener.Prefixes.Add(this.config["prefix"]);
|
this.httplistener.Prefixes.Add(this.config["prefix"]);
|
||||||
this.httplistener.Start();
|
this.httplistener.Start();
|
||||||
ThreadPool.QueueUserWorkItem((o) => {
|
_ = ThreadPool.QueueUserWorkItem((o) => {
|
||||||
Console.WriteLine("Webserver is Running...");
|
Console.WriteLine("Webserver is Running...");
|
||||||
try {
|
try {
|
||||||
while(this.httplistener.IsListening) {
|
while(this.httplistener.IsListening) {
|
||||||
@ -147,6 +147,9 @@ namespace BlubbFish.Utils.IoT.Bots {
|
|||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
this.httplistener.Stop();
|
this.httplistener.Stop();
|
||||||
this.httplistener.Close();
|
this.httplistener.Close();
|
||||||
|
if(this.databackend != null) {
|
||||||
|
this.databackend.Dispose();
|
||||||
|
}
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user