mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-29 07:07:24 +08:00
Fix TcpTransportListener resource leak in ServerBase.StopAsync (#3561)
ServerBase.StopAsync() calls Close() on each transport listener then Clear() on the list. ServerBase.Dispose() later iterates TransportListeners to call Dispose() on each — but the list is already empty, so TcpTransportListener.Dispose() never runs. Add Utils.SilentDispose() after Close() in StopAsync to ensure TcpTransportListener.Dispose() executes before the list is cleared.
This commit is contained in:
committed by
Roman Ettlinger
parent
55bc484704
commit
8981ab5955
@@ -554,7 +554,7 @@ namespace Opc.Ua
|
||||
ServerError = new ServiceResult(e);
|
||||
}
|
||||
|
||||
// close any listeners.
|
||||
// close and dispose any listeners.
|
||||
List<ITransportListener> listeners = TransportListeners;
|
||||
|
||||
if (listeners != null)
|
||||
@@ -572,6 +572,8 @@ namespace Opc.Ua
|
||||
"Unexpected error closing a listener {Name}.",
|
||||
listeners[ii].GetType().FullName);
|
||||
}
|
||||
|
||||
Utils.SilentDispose(listeners[ii]);
|
||||
}
|
||||
|
||||
listeners.Clear();
|
||||
|
||||
Reference in New Issue
Block a user