Пример #1
0
        private void ResolveReplNets(ClusterNic localNic, List <ClusterNetwork> unassignedNets)
        {
            List <PingRequest> list = new List <PingRequest>(30);

            foreach (ClusterNetwork clusterNetwork in unassignedNets)
            {
                if (clusterNetwork.LogicalNetwork == null && !this.DoesClusterNetworkContainNode(clusterNetwork, localNic.NodeName))
                {
                    this.SelectPingCandidates(clusterNetwork, list);
                }
            }
            if (list.Count > 0)
            {
                PingRequest[] array      = list.ToArray();
                PingProber    pingProber = null;
                try
                {
                    pingProber = new PingProber(localNic.IPAddress);
                    pingProber.SendPings(array);
                    pingProber.GatherReplies(3000);
                    foreach (PingRequest pingRequest in array)
                    {
                        if (pingRequest.Success)
                        {
                            ClusterNic clusterNic = (ClusterNic)pingRequest.UserContext;
                            if (clusterNic.ClusterNetwork.LogicalNetwork == null)
                            {
                                Subnet subnet = this.GetSubnet(clusterNic.ClusterNetwork.SubnetId);
                                clusterNic.ClusterNetwork.LogicalNetwork = localNic.ClusterNetwork.LogicalNetwork;
                                clusterNic.ClusterNetwork.LogicalNetwork.Add(subnet);
                            }
                        }
                    }
                }
                catch (SocketException arg)
                {
                    NetworkDiscovery.Tracer.TraceError <IPAddress, SocketException>((long)this.GetHashCode(), "Prober failed from {0}:{1}", localNic.IPAddress, arg);
                }
                finally
                {
                    if (pingProber != null)
                    {
                        pingProber.Dispose();
                    }
                }
            }
        }
Пример #2
0
        // Token: 0x06001815 RID: 6165 RVA: 0x000634CC File Offset: 0x000616CC
        private void CompletionCallback(IAsyncResult ar)
        {
            Exception ex = null;

            try
            {
                IPEndPoint ipendPoint = new IPEndPoint(IPAddress.Any, 0);
                EndPoint   endPoint   = ipendPoint;
                this.m_sourcePort.Socket.EndReceiveFrom(ar, ref endPoint);
                ipendPoint = (IPEndPoint)endPoint;
                PingRequest pingRequest = PingProber.FindRequest(this.m_activeRequests, ipendPoint.Address);
                if (pingRequest == null)
                {
                    PingProber.Tracer.TraceError <IPEndPoint>((long)this.GetHashCode(), "Unexpected response from {0}", ipendPoint);
                }
                else
                {
                    pingRequest.StopTimeStamp = Win32StopWatch.GetSystemPerformanceCounter();
                    PingProber.Tracer.TraceDebug <IPEndPoint>((long)this.GetHashCode(), "Response from {0}.", ipendPoint);
                    pingRequest.Success = true;
                }
            }
            catch (SocketException ex2)
            {
                ex = ex2;
            }
            catch (ObjectDisposedException ex3)
            {
                ex = ex3;
            }
            finally
            {
                lock (this)
                {
                    this.m_completionCount++;
                    if (this.m_completionCount == this.m_sendCount && (this.m_proberState == ProberState.Sent || this.m_proberState == ProberState.Gathering))
                    {
                        this.m_probeCompleteEvent.Set();
                    }
                }
                if (ex != null && this.m_proberState != ProberState.Disposed)
                {
                    PingProber.Tracer.TraceError <Exception>((long)this.GetHashCode(), "Ping completion failure: {0}", ex);
                }
            }
        }
Пример #3
0
        private void ResolveLocalNic(ClusterNic localNic)
        {
            Subnet subnet = this.GetSubnet(localNic.ClusterNetwork.SubnetId);

            if (localNic.ClusterState == AmNetInterfaceState.Up)
            {
                List <LogicalNetwork> list = this.FindLogicalNetsWithoutNode(localNic.NodeName);
                if (list.Count > 0)
                {
                    List <PingRequest> list2 = new List <PingRequest>(list.Count * 3);
                    foreach (LogicalNetwork logicalNetwork in list)
                    {
                        foreach (Subnet subnet2 in logicalNetwork.Subnets)
                        {
                            if (subnet2.ClusterNetwork != null)
                            {
                                this.SelectPingCandidates(subnet2.ClusterNetwork, list2);
                            }
                        }
                    }
                    if (list2.Count > 0)
                    {
                        PingRequest[] array      = list2.ToArray();
                        PingProber    pingProber = null;
                        try
                        {
                            pingProber = new PingProber(localNic.IPAddress);
                            pingProber.SendPings(array);
                            pingProber.GatherReplies(3000);
                            foreach (PingRequest pingRequest in array)
                            {
                                if (pingRequest.Success)
                                {
                                    ClusterNic clusterNic = (ClusterNic)pingRequest.UserContext;
                                    localNic.ClusterNetwork.LogicalNetwork = clusterNic.ClusterNetwork.LogicalNetwork;
                                    localNic.ClusterNetwork.LogicalNetwork.Add(subnet);
                                    break;
                                }
                            }
                        }
                        catch (SocketException arg)
                        {
                            NetworkDiscovery.Tracer.TraceError <IPAddress, SocketException>((long)this.GetHashCode(), "Prober failed from {0}:{1}", localNic.IPAddress, arg);
                        }
                        finally
                        {
                            if (pingProber != null)
                            {
                                pingProber.Dispose();
                            }
                        }
                    }
                }
            }
            if (localNic.ClusterNetwork.LogicalNetwork == null)
            {
                LogicalNetwork logicalNetwork2 = this.AddNewLogicalNetwork();
                logicalNetwork2.Add(subnet);
                localNic.ClusterNetwork.LogicalNetwork = logicalNetwork2;
            }
        }