diff --git a/lib/core/tools/Close-IcingaTcpConnection.psm1 b/lib/core/tools/Close-IcingaTcpConnection.psm1 new file mode 100644 index 0000000..65b532a --- /dev/null +++ b/lib/core/tools/Close-IcingaTcpConnection.psm1 @@ -0,0 +1,14 @@ +function Close-IcingaTcpConnection() +{ + param( + $TcpClient + ); + + if ($null -eq $TcpClient) { + return; + } + + $TcpClient.Close(); + $TcpClient.Dispose(); + $TcpClient = $null; +}