Exemplo n.º 1
0
 public DefaultServerMonitor(IOptions<ServerOptions> options,
     AppSessionContainer<AppSession> appSessionContainer,
     ILogger<DefaultServerMonitor> logger
     )
 {
     ServerOptions = options.Value;
     AppSessionContainer = appSessionContainer;
     Logger = logger;
 }
Exemplo n.º 2
0
 public static IHostBuilder UseArgo(this IHostBuilder builder, IConfiguration config)
 {
     return(builder.ConfigureServices((services) =>
     {
         services.Configure <ServerOptions>(config);
         services.AddSingleton <IPassThroughRuleProvider, PassThroughRuleProvider>();
         services.AddSingleton <IMessageRouter, MessageRouter>();
         services.AddSingleton <IPacketCodec, DefaultPacketCodec>();
         services.AddSingleton <INetListenerProvider, DotNettyListenerProvider>();
         var appSessionContainer = new AppSessionContainer <AppSession>();
         services.AddSingleton(appSessionContainer);
         services.AddSingleton <IHostedService, NetListenerService>();
         services.AddSingleton <IServerMonitor, DefaultServerMonitor>();
         services.AddSingleton <IHostedService, MonitorService>();
         var options = ConfigurationBinder.Get <ServerOptions>(config);
         if (options != null && options.Listeners.Any())
         {
             options.Listeners.ForEach(op =>
             {
                 services.AddCommands(op.CommandAssemblies);
             });
         }
     }));
 }