internal void BindTimeoutHandlers(ITimeoutHandlerContainer container, IServiceProvider provider) { foreach (var handlerType in _timeoutHandlerTypes) { var handler = (ITimeoutHandler)provider.GetService(handlerType); container.AddHandler(handler); } }
public EnetServer( EnetConfiguration configuration, IServiceProvider serviceProvider, ILogger <EnetServer> logger, IConnectionHandlerContainer connectionHandlers, IDisconnectionHandlerContainer disconnectionHandlers, ITimeoutHandlerContainer timeoutHandlers, IPacketHandlerContainer packetHandlers ) { _configuration = configuration; _logger = logger; _connectionHandlers = connectionHandlers; _disconnectionHandlers = disconnectionHandlers; _timeoutHandlers = timeoutHandlers; _packetHandlers = packetHandlers; _configuration.BindConnectionHandlers(_connectionHandlers, serviceProvider); _configuration.BindDisconnectionHandlers(_disconnectionHandlers, serviceProvider); _configuration.BindTimeoutHandlers(_timeoutHandlers, serviceProvider); _configuration.BindPacketHandlers(_packetHandlers, serviceProvider); }