-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #678 from Icinga:fix/core_memory_leaks
Fix: Various memory leak fixes and improvements
- Loading branch information
Showing
12 changed files
with
62 additions
and
57 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ cache/* | |
*.log | ||
*.pfx | ||
*.dll | ||
*.DS_Store | ||
|
||
# JEA | ||
RoleCapabilities/IcingaForWindows.psrc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
function Close-IcingaTCPConnection() | ||
{ | ||
param( | ||
[System.Net.Sockets.TcpClient]$Client = $null | ||
[hashtable]$Connection = @{ } | ||
); | ||
|
||
if ($null -eq $Client) { | ||
if ($null -eq $Connection -Or $Connection.Count -eq 0) { | ||
$Connection = $null; | ||
|
||
return; | ||
} | ||
|
||
Write-IcingaDebugMessage -Message ( | ||
[string]::Format( | ||
'Closing client connection for endpoint {0}', | ||
(Get-IcingaTCPClientRemoteEndpoint -Client $Client) | ||
(Get-IcingaTCPClientRemoteEndpoint -Client $Connection.Client) | ||
) | ||
); | ||
|
||
$Client.Close(); | ||
$Client.Dispose(); | ||
$Client = $null; | ||
try { | ||
if ($null -ne $Connection.Stream) { | ||
$Connection.Stream.Close(); | ||
$Connection.Stream.Dispose(); | ||
$Connection.Stream = $null; | ||
} | ||
} catch { | ||
$Connection.Stream = $null; | ||
} | ||
try { | ||
if ($null -ne $Connection.Client) { | ||
$Connection.Client.Close(); | ||
$Connection.Client.Dispose(); | ||
$Connection.Client = $null; | ||
} | ||
} catch { | ||
$Connection.Client = $null; | ||
} | ||
|
||
$Connection = $null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters