Fix
This commit is contained in:
@@ -46,8 +46,6 @@ namespace Modbus.Net
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void SendingMessageControlInner()
|
protected override void SendingMessageControlInner()
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
_taskCycleSema?.WaitOne();
|
_taskCycleSema?.WaitOne();
|
||||||
while (!_taskCancel)
|
while (!_taskCancel)
|
||||||
@@ -58,6 +56,8 @@ namespace Modbus.Net
|
|||||||
}
|
}
|
||||||
bool sendSuccess = false;
|
bool sendSuccess = false;
|
||||||
lock (WaitingMessages)
|
lock (WaitingMessages)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (_currentSendingPos == null)
|
if (_currentSendingPos == null)
|
||||||
{
|
{
|
||||||
@@ -84,22 +84,24 @@ namespace Modbus.Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (ObjectDisposedException e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, "Controller _currentSendingPos disposed");
|
||||||
|
_currentSendingPos = null;
|
||||||
|
sendSuccess = true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, "Controller throws exception");
|
||||||
|
_taskCancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (sendSuccess)
|
if (sendSuccess)
|
||||||
{
|
{
|
||||||
_taskCycleSema?.WaitOne();
|
_taskCycleSema?.WaitOne();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
logger.LogError(e, "Controller throws exception");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void SendStart()
|
public override void SendStart()
|
||||||
|
|||||||
Reference in New Issue
Block a user