Пример #1
0
 public RpcServer(NeoSystem system, RpcServerSettings settings)
 {
     this.system   = system;
     this.settings = settings;
     localNode     = system.LocalNode.Ask <LocalNode>(new LocalNode.GetInstance()).Result;
     RegisterMethods(this);
 }
Пример #2
0
 public void UpdateSettings(RpcServerSettings settings)
 {
     this.RpcUser         = settings.RpcUser;
     this.RpcPass         = settings.RpcPass;
     this.MaxGasInvoke    = settings.MaxGasInvoke;
     this.MaxFee          = settings.MaxFee;
     this.DisabledMethods = settings.DisabledMethods;
 }
Пример #3
0
        protected override void Configure()
        {
            var loadedSettings = new RpcServerSettings(GetConfiguration());

            if (this.settings == null)
            {
                this.settings = loadedSettings;
            }
            else
            {
                this.settings.UpdateSettings(loadedSettings);
            }
        }
Пример #4
0
        protected override void OnSystemLoaded(NeoSystem system)
        {
            RpcServerSettings s = settings.Servers.FirstOrDefault(p => p.Network == system.Settings.Magic);

            if (s is null)
            {
                return;
            }

            RpcServer server = new RpcServer(system, s);

            if (handlers.Remove(s.Network, out var list))
            {
                foreach (var handler in list)
                {
                    server.RegisterMethods(handler);
                }
            }

            server.StartRpcServer();
            servers.TryAdd(s.Network, server);
        }
Пример #5
0
 public RpcServer(NeoSystem system, RpcServerSettings settings)
 {
     this.system   = system;
     this.settings = settings;
     RegisterMethods(this);
 }
Пример #6
0
 public Settings(IConfigurationSection section)
 {
     Servers = section.GetSection(nameof(Servers)).GetChildren().Select(p => RpcServerSettings.Load(p)).ToArray();
 }