예제 #1
0
        public GingerNodeProxy GetNodeProxy(GingerNodeInfo gingerNodeInfo)
        {
            GingerNodeProxy gingerNodeProxy = null;
            bool            b = GingerNodeProxyDictionary.TryGetValue(gingerNodeInfo, out gingerNodeProxy);

            if (!b)
            {
                gingerNodeProxy            = new GingerNodeProxy(gingerNodeInfo);
                gingerNodeProxy.GingerGrid = this;
                GingerNodeProxyDictionary.Add(gingerNodeInfo, gingerNodeProxy);
            }
            return(gingerNodeProxy);
        }
        /// <summary>
        /// Find Node in Remote Grid and return GingerNodeProxy
        /// </summary>
        /// <param name="ServiceID"></param>
        /// <param name="remoteServiceGrids"></param>
        /// <returns></returns>
        public static GingerNodeProxy FindRemoteNode(string ServiceID, ObservableList <RemoteServiceGrid> remoteServiceGrids)
        {
            foreach (RemoteServiceGrid remoteServiceGrid in remoteServiceGrids)
            {
                GingerSocketClient2 hubClient = new GingerSocketClient2();
                hubClient.Connect(remoteServiceGrid.Host, remoteServiceGrid.HostPort);

                NewPayLoad findNodePayload = new NewPayLoad(SocketMessages.FindNode, ServiceID, "ccc");    // !!!!!!!!!!!!!!!!   ccc
                NewPayLoad RC = hubClient.SendRequestPayLoad(findNodePayload);
                if (RC.Name == "NodeInfo")
                {
                    Guid            sessionID       = RC.GetGuid();
                    GingerNodeProxy gingerNodeProxy = new GingerNodeProxy(hubClient, sessionID);
                    return(gingerNodeProxy);
                }
            }
            return(null);
        }