修改代码
This commit is contained in:
parent
c0716d9667
commit
274b1a7a83
@ -17,14 +17,10 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||||||
services.AddTcpService(config =>
|
services.AddTcpService(config =>
|
||||||
{
|
{
|
||||||
config.SetListenIPHosts(int.Parse(configuration["TCP:ClientPort"] ?? "10500"))
|
config.SetListenIPHosts(int.Parse(configuration["TCP:ClientPort"] ?? "10500"))
|
||||||
.ConfigureContainer(a => //容器的配置顺序应该在最前面
|
|
||||||
{
|
|
||||||
a.AddConsoleLogger();
|
|
||||||
})
|
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
a.Add<TcpClosePlugin>();
|
a.Add<TcpClosePlugin>();
|
||||||
a.Add<TcpServiceReceivedPlugin>();
|
a.Add<TcpServicePlugin>();
|
||||||
a.Add<BusService>();
|
a.Add<BusService>();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -40,13 +36,9 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||||||
services.AddUdpSession(config =>
|
services.AddUdpSession(config =>
|
||||||
{
|
{
|
||||||
config.SetBindIPHost(int.Parse(configuration["UDP:ClientPort"] ?? "10500"))
|
config.SetBindIPHost(int.Parse(configuration["UDP:ClientPort"] ?? "10500"))
|
||||||
.ConfigureContainer(a => //容器的配置顺序应该在最前面
|
|
||||||
{
|
|
||||||
//a.AddConsoleLogger();
|
|
||||||
})
|
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
a.Add<UdpServiceReceivedPlugin>();
|
a.Add<UdpServicePlugin>();
|
||||||
a.Add<BusService>();
|
a.Add<BusService>();
|
||||||
})
|
})
|
||||||
.UseBroadcast()
|
.UseBroadcast()
|
||||||
|
|||||||
@ -9,15 +9,15 @@ using JiShe.CollectBus.MongoDB;
|
|||||||
|
|
||||||
namespace JiShe.CollectBus.Core.Plugins
|
namespace JiShe.CollectBus.Core.Plugins
|
||||||
{
|
{
|
||||||
public partial class TcpServiceReceivedPlugin : PluginBase
|
public partial class TcpServicePlugin : PluginBase
|
||||||
{
|
{
|
||||||
private readonly INSender _nSender;
|
private readonly INSender _nSender;
|
||||||
private readonly ILogger<TcpServiceReceivedPlugin> _logger;
|
private readonly ILogger<TcpServicePlugin> _logger;
|
||||||
public readonly IMongoRepository<MessageReceivedHeartbeatEvent> _mongoHeartbeatRepository;
|
public readonly IMongoRepository<MessageReceivedHeartbeatEvent> _mongoHeartbeatRepository;
|
||||||
public readonly IMongoRepository<MessageReceivedLoginEvent> _mongoLoginRepository;
|
public readonly IMongoRepository<MessageReceivedLoginEvent> _mongoLoginRepository;
|
||||||
|
|
||||||
|
|
||||||
public TcpServiceReceivedPlugin(INSender nSender, ILogger<TcpServiceReceivedPlugin> logger,IMongoRepository<MessageReceivedHeartbeatEvent> mongoHeartbeatRepository, IMongoRepository<MessageReceivedLoginEvent> mongoLoginRepository)
|
public TcpServicePlugin(INSender nSender, ILogger<TcpServicePlugin> logger,IMongoRepository<MessageReceivedHeartbeatEvent> mongoHeartbeatRepository, IMongoRepository<MessageReceivedLoginEvent> mongoLoginRepository)
|
||||||
{
|
{
|
||||||
_nSender = nSender;
|
_nSender = nSender;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@ -4,7 +4,7 @@ using TouchSocket.Sockets;
|
|||||||
|
|
||||||
namespace JiShe.CollectBus.Core.Plugins
|
namespace JiShe.CollectBus.Core.Plugins
|
||||||
{
|
{
|
||||||
public partial class UdpServiceReceivedPlugin : PluginBase
|
public partial class UdpServicePlugin : PluginBase
|
||||||
{
|
{
|
||||||
[GeneratorPlugin(typeof(IUdpReceivedPlugin))]
|
[GeneratorPlugin(typeof(IUdpReceivedPlugin))]
|
||||||
public async Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
|
public async Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
|
||||||
Loading…
x
Reference in New Issue
Block a user