Fix
This commit is contained in:
@@ -76,6 +76,7 @@ namespace Modbus.Net
|
|||||||
{
|
{
|
||||||
if (!repeat && messageSendingdef.ReceiveMessage == null)
|
if (!repeat && messageSendingdef.ReceiveMessage == null)
|
||||||
{
|
{
|
||||||
|
asyncLock?.Dispose();
|
||||||
return await SendMsgInner(message, true);
|
return await SendMsgInner(message, true);
|
||||||
}
|
}
|
||||||
return messageSendingdef;
|
return messageSendingdef;
|
||||||
|
|||||||
@@ -53,8 +53,9 @@ namespace Modbus.Net
|
|||||||
/// 发送内部
|
/// 发送内部
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message">发送的信息</param>
|
/// <param name="message">发送的信息</param>
|
||||||
|
/// <param name="repeat">是否为重发消息</param>
|
||||||
/// <returns>发送信息的定义</returns>
|
/// <returns>发送信息的定义</returns>
|
||||||
protected async Task<MessageWaitingDef> SendMsgInner(byte[] message)
|
protected async Task<MessageWaitingDef> SendMsgInner(byte[] message, bool repeat = false)
|
||||||
{
|
{
|
||||||
IDisposable asyncLock = null;
|
IDisposable asyncLock = null;
|
||||||
try
|
try
|
||||||
@@ -77,6 +78,11 @@ namespace Modbus.Net
|
|||||||
success = messageSendingdef.ReceiveMutex.WaitOne(TimeoutTime);
|
success = messageSendingdef.ReceiveMutex.WaitOne(TimeoutTime);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
|
if (!repeat && messageSendingdef.ReceiveMessage == null)
|
||||||
|
{
|
||||||
|
asyncLock?.Dispose();
|
||||||
|
return await SendMsgInner(message, true);
|
||||||
|
}
|
||||||
return messageSendingdef;
|
return messageSendingdef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user