示例#1
0
        void App_VMuktiEvent_GetSuperNodeIP(object sender, VMuktiEventArgs e)
        {
            //ClsException.WriteToLogFile("calling WebReqSuperNode  at " + DateTime.Now.ToString());
            if (!WebReqSuperNode())
            {
                //ClsException.WriteToLogFile("WebReqSuperNode result is false ");
                string PreviousSuperNode = VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP;

                string SuperNodeName = null;
                if (PreviousSuperNode != null || PreviousSuperNode != string.Empty)
                {
                    try
                    {
                        //ClsException.WriteToLogFile("calling bs http  svcGetNodeNameByIP");
                        SuperNodeName = App.chHttpBootStrapService.svcGetNodeNameByIP(PreviousSuperNode);
                        /********** SuperNode Down *************/
                        //ClsException.WriteToLogFile("called bs http  svcGetNodeNameByIP");
                        //ClsException.WriteToLogFile("calling bs http svcHttpBsGetSuperNodeIP");
                        clsSuperNodeDataContract objSuperNodeDataContract = App.chHttpBootStrapService.svcHttpBsGetSuperNodeIP(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName, VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP, false);
                        //ClsException.WriteToLogFile("called bs http svcHttpBsGetSuperNodeIP");
                        VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP = objSuperNodeDataContract.SuperNodeIP;


                        //ClsException.WriteToLogFile("calling Stop timer with true");
                        VMuktiAPI.VMuktiHelper.CallEvent("StopTimer", null, new VMuktiEventArgs(true));
                        //ClsException.WriteToLogFile("Stop timer called with true");


                        App.chHttpSuperNodeService = (IHttpSuperNodeService)App.objHttpSuperNode.OpenClient<IHttpSuperNodeService>("http://" + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP + ":80/HttpSuperNode");
                        App.chHttpSuperNodeService.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName, VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType.ToString());                        
                        

                        if (SuperNodeName != null || SuperNodeName != string.Empty)
                        {
                            App.chHttpSuperNodeService.svcGetNodeNameByIP(SuperNodeName, PreviousSuperNode);
                        }

                        //ClsException.WriteToLogFile("calling Stop timer with false");
                        VMuktiAPI.VMuktiHelper.CallEvent("StopTimer", null,new VMuktiEventArgs(false));
                        //ClsException.WriteToLogFile("Stop timer called with false");
                    }
                    catch(Exception exp)
                    {
                        /********* Internet of Node is Down *********/
                        /********* Start Healing Component for Node *********/
                        //ClsException.WriteToLogFile("IN EXCEPTION " + exp.Message.ToString());
                        VMuktiHelper.CallEvent("StopTimer", null, new VMuktiEventArgs(true));
                        //ClsException.WriteToLogFile("starting timer to ping supernode");
                        dtWebReqBS.Start();
                        //ClsException.WriteToLogFile("started timer to ping supernode");
                        blnNodeOff = true;
                        return;
                    }
                }
            }
        }
示例#2
0
 public static void OpenSuperNodeClients()
 {
     try
     {
         App.chHttpSuperNodeService = (IHttpSuperNodeService)App.objHttpSuperNode.OpenClient<IHttpSuperNodeService>("http://" + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP + ":80/HttpSuperNode");
         App.chHttpSuperNodeService.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName, VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType.ToString());
         //ClsException.WriteToLogFile("SvcJoin of SuperNode called for Disaster Recovery at " + DateTime.Now.ToString());
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "OpenSuperNodeClients()", "App.xaml.cs");
     }
 }
示例#3
0
		private void Dispose(bool disposing)
		{
           
			if (!this.disposed)
			{
				if (disposing)
				{
					try
					{
						if (chHttpBootStrapService != null)
						{
							chHttpBootStrapService = null;
						}
						if (objHttpBootStrap != null)
						{
							objHttpBootStrap = null;
						}

						if (App.chNetP2PSuperNodeChannel != null)
						{
							((NetPeerClient)App.objNetP2PSuperNode).CloseClient<INetP2PSuperNodeChannel>();
							App.chNetP2PSuperNodeChannel = null;
						}
						if (App.objNetP2PSuperNode != null)
						{
							App.objNetP2PSuperNode = null;
						}						
						if (chHttpSuperNodeService != null)
						{
							chHttpSuperNodeService = null;
						}
						if (objHttpSuperNode != null)
						{
							objHttpSuperNode = null;
						}
						if (objNetP2PSuperNode != null)
						{
							objNetP2PSuperNode = null;
						}
						if (chNetP2PSuperNodeChannel != null)
						{
							chNetP2PSuperNodeChannel = null;
						}
						
						if (DomainSetUp != null)
						{
							DomainSetUp = null;
						}
						if (thBootStrapDomain != null)
						{
							thBootStrapDomain = null;
						}
						if (thSuperNodeDomain != null)
						{
							thSuperNodeDomain = null;
						}
					}
					catch (Exception ex)
					{
                        VMuktiHelper.ExceptionHandler(ex, "Dispose()", "App.xaml.cs");
					}
				}
				disposed = true;
			}
			GC.SuppressFinalize(this);
		}