Fix broker disposing client
This commit is contained in:
@@ -51,10 +51,10 @@ namespace PlantBox.Broker
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ClientLoop(TcpClient client)
|
private void ClientLoop(TcpClient client)
|
||||||
{
|
|
||||||
using (var commandStream = new CommandStream(client.GetStream()))
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
using (var commandStream = new CommandStream(client.GetStream()))
|
||||||
{
|
{
|
||||||
while (client.Connected)
|
while (client.Connected)
|
||||||
{
|
{
|
||||||
@@ -79,12 +79,14 @@ namespace PlantBox.Broker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.Close();
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log($"Client disconnected: {ex.Message}");
|
Log($"Client disconnected: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected void Log(string message)
|
protected void Log(string message)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user