fix: 上一提交导致other通道创建错误

This commit is contained in:
Diego
2024-12-24 17:21:10 +08:00
parent ed4332ea78
commit 6cba0601fd
4 changed files with 15 additions and 6 deletions

View File

@@ -243,7 +243,10 @@ internal abstract class DeviceHostedService : BackgroundService, IDeviceHostedSe
{
// 如果找到了匹配的通道线程,则将驱动程序添加到该线程中
channelThread.AddDriver(driverBase);
await channelThread.Channel.SetupAsync(channelThread.FoundataionConfig.Clone()).ConfigureAwait(false);
if (channelThread.Channel != null)
{
await channelThread.Channel.SetupAsync(channelThread.FoundataionConfig?.Clone()).ConfigureAwait(false);
}
return channelThread;
}
@@ -301,7 +304,10 @@ internal abstract class DeviceHostedService : BackgroundService, IDeviceHostedSe
// 创建新的通道线程,并将驱动程序添加到其中
ChannelThread channelThread = new ChannelThread(channel, config, ichannel);
channelThread.AddDriver(driverBase);
await channelThread.Channel.SetupAsync(channelThread.FoundataionConfig.Clone()).ConfigureAwait(false);
if (channelThread.Channel != null)
{
await channelThread.Channel.SetupAsync(channelThread.FoundataionConfig?.Clone()).ConfigureAwait(false);
}
ChannelThreads.Add(channelThread);
return channelThread;
}

View File

@@ -461,7 +461,10 @@ public class ChannelThread
driver?.ConfigurePlugins();
}
// 设置通道的底层配置
await Channel.SetupAsync(FoundataionConfig?.Clone()).ConfigureAwait(false);
if (Channel != null)
{
await Channel.SetupAsync(FoundataionConfig?.Clone()).ConfigureAwait(false);
}
}
else
{

View File

@@ -134,7 +134,7 @@ public abstract class DriverBase : DisposableObject
{
if (Protocol != null)
{
FoundataionConfig.ConfigurePlugins(Protocol.ConfigurePlugins());
FoundataionConfig?.ConfigurePlugins(Protocol.ConfigurePlugins());
}
}
@@ -184,7 +184,7 @@ public abstract class DriverBase : DisposableObject
/// <summary>
/// 底层驱动配置
/// </summary>
public TouchSocketConfig FoundataionConfig => ChannelThread?.FoundataionConfig;
public TouchSocketConfig? FoundataionConfig => ChannelThread?.FoundataionConfig;
/// <summary>
/// 日志

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>7.2.0.91</Version>
<Version>7.2.0.92</Version>
</PropertyGroup>
<ItemGroup>