listener: When disposing, close socket before killing thread. Fixes #1601
This commit is contained in:
parent
2679235bb7
commit
6d5f23cb19
|
@ -164,7 +164,10 @@ namespace SparkleLib {
|
|||
|
||||
public virtual void Dispose ()
|
||||
{
|
||||
this.reconnect_timer.Dispose ();
|
||||
if (this.reconnect_timer != null) {
|
||||
this.reconnect_timer.Stop ();
|
||||
this.reconnect_timer.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -237,12 +237,14 @@ namespace SparkleLib {
|
|||
|
||||
public override void Dispose ()
|
||||
{
|
||||
if (this.socket != null) {
|
||||
this.socket.Close ();
|
||||
this.socket = null;
|
||||
}
|
||||
|
||||
this.thread.Abort ();
|
||||
this.thread.Join ();
|
||||
|
||||
if (this.socket != null)
|
||||
this.socket.Close ();
|
||||
|
||||
base.Dispose ();
|
||||
}
|
||||
|
||||
|
|
|
@ -619,6 +619,8 @@ namespace SparkleLib {
|
|||
this.listener.Disconnected -= ListenerDisconnectedDelegate;
|
||||
this.listener.AnnouncementReceived -= ListenerAnnouncementReceivedDelegate;
|
||||
|
||||
this.listener.Dispose ();
|
||||
|
||||
if (!UseCustomWatcher)
|
||||
this.watcher.Dispose ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue