示例#1
0
        protected override void OnStop()
        {
            TunnelHelper.ChangeTunnelStatus(TunnelStatuses.Paused, false);
            Thread.Sleep(300);

            WcfServerHelper.BroadcastRemoteCallback(x => x.ServerStopping(), true);
            Thread.Sleep(300);

            WcfServerHelper.Stop();
        }
示例#2
0
        public void SaveSettings(ServiceSettings serviceSettings, bool restartPlink)
        {
            SettingsHelper.SaveSettings(serviceSettings);

            WcfServerHelper.BroadcastRemoteCallback(x => x.SaveSettingsCallback(SettingsHelper.GetSettings()), true);

            if (restartPlink && TunnelHelper.CurrentTunnelStatus == TunnelStatuses.Started)
            {
                TunnelHelper.ChangeTunnelStatus(TunnelStatuses.Paused, false);
                Thread.Sleep(400);
                TunnelHelper.ChangeTunnelStatus(TunnelStatuses.Started, false);
            }
        }
示例#3
0
        protected override void OnStart(string[] args)
        {
            if (Settings.Default.UpgradeRequired)
            {
                Settings.Default.Upgrade();
                Settings.Default.UpgradeRequired = false;
                Settings.Default.Save();
            }

            WcfServerHelper.Start(typeof(ServiceRemoting));

            _pingClientTimer           = new System.Timers.Timer(Constants.ServerPingInterval * 1000);
            _pingClientTimer.AutoReset = true;
            _pingClientTimer.Elapsed  += pingTimer_Elapsed;
            _pingClientTimer.Start();

            Settings settings = new Settings();

            if (settings.CurrentTunnelStatus == (int)TunnelStatuses.Started)
            {
                TunnelHelper.ChangeTunnelStatus(TunnelStatuses.Started, false);
            }
        }
示例#4
0
 public void ChangeTunnelStatus(TunnelStatuses tunnelStatus)
 {
     TunnelHelper.ChangeTunnelStatus(tunnelStatus);
 }