Add debug output messages for TCP handling

This commit is contained in:
Christian Stein 2020-03-24 15:32:14 +01:00
parent b947f71f3a
commit 08e3594008
4 changed files with 35 additions and 0 deletions

View file

@ -8,6 +8,13 @@ function Close-IcingaTCPConnection()
return;
}
Write-IcingaDebugMessage -Message (
[string]::Format(
'Closing client connection for endpoint {0}',
$Client.Client.RemoteEndPoint
)
);
$Client.Close();
$Client.Dispose();
$Client = $null;

View file

@ -8,5 +8,12 @@ function Close-IcingaTCPSocket()
return;
}
Write-IcingaDebugMessage -Message (
[string]::Format(
'Closing TCP socket {0}',
$Socket.LocalEndpoint
)
);
$Socket.Stop();
}

View file

@ -10,5 +10,12 @@ function New-IcingaTCPClient()
[System.Net.Sockets.TcpClient]$Client = $Socket.AcceptTcpClient();
Write-IcingaDebugMessage -Message (
[string]::Format(
'New incoming client connection for endpoint {0}',
$Client.Client.RemoteEndPoint
)
);
return $Client;
}

View file

@ -11,7 +11,21 @@ function New-IcingaTCPSocket()
$TCPSocket = [System.Net.Sockets.TcpListener]$Port;
Write-IcingaDebugMessage -Message (
[string]::Format(
'Creating new TCP socket on Port {0}. Endpoint configuration {1}',
$Port,
$TCPSocket.LocalEndpoint
)
);
if ($Start) {
Write-IcingaDebugMessage -Message (
[string]::Format(
'Starting TCP socket for endpoint {0}',
$TCPSocket.LocalEndpoint
)
);
$TCPSocket.Start();
}