Esempio n. 1
0
 public static void OnDisconnected(Socket sock)
 {
     if (ServicesAPI.cbOnDisconnected != null)
     {
         ServicesAPI.cbOnDisconnected(sock);
     }
 }
Esempio n. 2
0
        public static bool RestartListener(bool newSSL, int newPort, EcoHandler handle)
        {
            ServicesAPI.StopEcoService();
            bool flag = ServicesAPI.StartEcoService(newSSL, newPort, handle);

            if (flag)
            {
                Common.WriteLine(string.Concat(new object[]
                {
                    "Eco Listener is restarted successfully, ssl=",
                    newSSL,
                    ", port=",
                    newPort
                }), new string[0]);
            }
            else
            {
                Common.WriteLine(string.Concat(new object[]
                {
                    "Failed to restart Eco Listener, ssl=",
                    newSSL,
                    ", port=",
                    newPort
                }), new string[0]);
            }
            return(flag);
        }
Esempio n. 3
0
 public static void OnAccepted(Socket sock)
 {
     Common.WriteLine("OnAccepted: {0}", new string[]
     {
         sock.LocalEndPoint.ToString()
     });
     if (ServicesAPI.cbOnAccepted != null)
     {
         ServicesAPI.cbOnAccepted(sock);
     }
 }
Esempio n. 4
0
 public static void StopDispatcher()
 {
     lock (DispatchAPI._lockDispatch)
     {
         Common.WriteLine("StopDispatcher ...", new string[0]);
         if (DispatchAPI._ecoHandler != null)
         {
             DispatchAPI._ecoHandler.Stop();
         }
         DispatchAPI._ecoHandler = null;
         ServicesAPI.StopEcoService();
         SessionAPI.StopSessionManager();
         Common.WriteLine("StopDispatcher Done", new string[0]);
     }
 }
Esempio n. 5
0
        public static bool StartDispatcher(int port, bool useSSL = true)
        {
            bool result;

            lock (DispatchAPI._lockDispatch)
            {
                try
                {
                    DispatchAPI._isServerRole = true;
                    if (port == 0)
                    {
                        DispatchAPI._localConnection = true;
                    }
                    else
                    {
                        DispatchAPI.ExtractCertificate("MonitorServers.pfx");
                    }
                    SessionAPI.StartSessionManager();
                    DispatchAPI._ecoHandler = new EcoHandler();
                    DispatchAPI._ecoHandler.Start(true);
                    DeviceInfo.cbOnDBUpdated          = new DeviceInfo.DelegateOnDbUpdate(DispatchAPI._ecoHandler.OnReloadDBData);
                    DevAccessCfg._cbOnAutoModeUpdated = new DevAccessCfg.DelegateOnAutoModeUpdate(DispatchAPI._ecoHandler.OnAutoDiscovery);
                    bool flag2 = ServicesAPI.StartEcoService(useSSL, port, DispatchAPI._ecoHandler);
                    result = flag2;
                }
                catch (Exception ex)
                {
                    Common.WriteLine("StartDispatcher: {0}", new string[]
                    {
                        ex.Message
                    });
                    result = false;
                }
            }
            return(result);
        }
Esempio n. 6
0
 public static bool Command4Service(Dictionary <string, string> req)
 {
     if (req.Count == 0)
     {
         return(false);
     }
     if (req.ContainsKey("RestartListener"))
     {
         string[] array = req["RestartListener"].Split(new char[]
         {
             ','
         });
         if (array.Length >= 2)
         {
             bool newSSL = Convert.ToInt32(array[0].Trim()) > 0;
             int  num    = Convert.ToInt32(array[1].Trim());
             if (num > 0)
             {
                 return(ServicesAPI.RestartListener(newSSL, num, DispatchAPI._ecoHandler));
             }
         }
     }
     return(false);
 }