Exemple #1
0
        void ProcessUdpDisConnection(UdpConnection udpCon)
        {
            string address = udpCon.RemoteEndPoint.Address.ToString();
            int    port    = udpCon.RemoteEndPoint.Port;

            //host <--> server connection
            if (hostUser.IsProxyServer(address, port) == true)
            {
                Debug.LogError("ProcessUdpDisConnection#ProxyServer ipv4:" + udpCon.RemoteEndPoint.ToString());
                hostUser.PeerConnect = null;

                //通知外部事件更改.
                NetWorkStateInfo info = new NetWorkStateInfo();
                info.state = EClientNetWorkState.DisConnected;
                owner.CallUdpProxyServerState(info);
                return;
            }

            /*
             * foreach (KeyValuePair<UInt32, P2PUser> peerUser in peerList)
             * {
             *      if (peerUser.Value.PeerConnect == null)
             *      {
             *              Log.info("P2PClientNetWork",  "ProcessUdpDisConnection#ignore uin:" + peerUser.Key);
             *              continue;
             *      }
             *
             *      if ( peerUser.Value.IsUserPoint(address, port) == true )
             *      {
             *              Log.info("P2PClientNetWork",  "ProcessUdpDisConnection#Find user:"******" ipv4:" + udpCon.RemoteEndPoint.ToString());
             *              peerUser.Value.PeerConnect = null;
             *              return;
             *      }
             * }*/
        }
Exemple #2
0
 //在主线程的update里面回调.
 public void  CallBackNetState(NetWorkStateInfo info)
 {
     if (m_StateCallBack != null)
     {
         m_StateCallBack(info.state, m_strRomoteIP, m_uRemotePort, info.exception);
     }
 }
Exemple #3
0
 /// <summary>
 /// Calls the state of the UDP proxy server.IP and port keep the same present.
 /// </summary>
 /// <param name="info">Info.</param>
 public void CallUdpProxyServerState(NetWorkStateInfo info)
 {
     if (m_ProxyStateCallback != null)
     {
         m_ProxyStateCallback(info.state, m_strRomoteIP, m_uRemotePort);
     }
 }
Exemple #4
0
 private void CallBackNetStateMarker(NetWorkStateInfo info)
 {
     lock (m_networkState)
     {
         isStateChanged = true;
     }
 }