Example #1
0
        private void AddPackage(NetPackage package)
        {
            if (package == null)
            {
                return;
            }

            if (package.RemoteEP.Port != NetService.SocketSendPort)
            {
                return;
            }

            package.RemoteEP.Port = NetService.SocketReadPort;

            if (package.CommandID != NetCommandType.RemoveProcessedPackage)
            {
                OutgoingPackagePool.AddFirst(NetPackageGenerater.TellReceived(package.ID, package.RemoteEP));
            }

            string key    = UserInfo.ToUserToken(package.RemoteEP);
            Sender sender = null;

            if (m_senders.ContainsKey(key))
            {
                sender = m_senders[key];
            }
            else
            {
                sender = new Sender(package.RemoteEP);
                m_senders.Add(key, sender);
            }

            sender.AddPackage(package);
        }
Example #2
0
        private void thread_refresh_user_list(int ellapse)
        {
            user_refresh_timer += ellapse;
            if (user_refresh_timer > broadcast_timer_array[broadcast_timer_array_index])
            {
                if (broadcast_timer_array_index + 1 < broadcast_timer_array.Length)
                {
                    broadcast_timer_array_index++;
                }

                user_refresh_timer = 0;
                OutgoingPackagePool.AddFirst(NetPackageGenerater.BroadcastFindUser());
            }
        }