Exemple #1
0
 private void OnConnected(IOEventResult result)
 {
     if (result.Result == AegisResult.Ok)
         Logger.Info("[{0}] Connected", SessionId);
     else
         Connect("127.0.0.1", 10100);
 }
        public bool Dispatch(StreamBuffer buffer)
        {
            var responses = new List<Data>();

            lock (_listResponseAction)
            {
                foreach (var data in _listResponseAction)
                    responses.Add(data);
            }

            foreach (var data in responses)
            {
                if (data.Predicate(buffer) == true)
                {
                    lock (_listResponseAction)
                        _listResponseAction.Remove(data);

                    var result = new IOEventResult(_session, IOEventType.Read,
                                                   buffer.Buffer, 0, buffer.WrittenBytes, AegisResult.Ok);
                    data.Dispatcher(result);
                    return true;
                }
            }

            return false;
        }
 private void NetworkConnected(IOEventResult result)
 {
     if (_tcsConnect != null)
     {
         _tcsConnect.SetResult(result.Result == AegisResult.Ok);
         _tcsConnect = null;
     }
 }
Exemple #4
0
        private void OnReceived(IOEventResult result)
        {
            IntervalCounter.Counters["ReceiveCount"].Add(1);
            IntervalCounter.Counters["ReceiveBytes"].Add(result.Buffer.Length);

            Packet packet = new Packet(result.Buffer);
            Logger.Err("Invalid packet received(PacketId={0:X})", packet.PacketId);
        }
Exemple #5
0
        private void OnAcceptd(IOEventResult result)
        {
            Logger.Info("[{0}] Accepted", SessionId);

            //  Hello packet을 클라이언트에 전달
            Packet packet = new Packet(Protocol.Hello_Ntf);
            SendPacket(packet);
        }
Exemple #6
0
 private void OnClosed(IOEventResult result)
 {
     if (result.Result == AegisResult.Ok)
     {
         Logger.Info("[{0}] Closed", SessionId);
     }
     else
     {
         Logger.Info("[{0}] Closed by remote.", SessionId);
         Connect("127.0.0.1", 10100);
     }
 }
Exemple #7
0
 private void NetworkEvent_Receive(IOEventResult result)
 {
     try
     {
         int packetSize;
         if (Packet.IsValidPacket(result.Buffer, 0, result.Buffer.Length, out packetSize) == true)
         {
             Packet packet = new Packet(result.Buffer);
             if (_packetDispatcher.Dispatch(new ReceiveData(result.Sender as EndPoint, packet)) == false)
                 Logger.Err("[GameProcess] Invalid packet received(pid=0x{0:X}).", packet.PacketId);
         }
     }
     catch (Exception e)
     {
         Logger.Err(e.ToString());
     }
 }
        private void NetworkClosed(IOEventResult result)
        {
            lock (_listTCS)
            {
                foreach (TCSData data in _listTCS)
                    data.tcs.SetCanceled();

                _listTCS.Clear();
            }


            if (_tcsConnect != null)
            {
                _tcsConnect.SetException(new AegisException("Connection closed when trying ConnectAndWait()"));
                _tcsConnect = null;
            }
        }
Exemple #9
0
 private void OnReceived(IOEventResult result)
 {
     Packet packet = new Packet(result.Buffer);
     Logger.Err("Invalid packet received(PacketId={0:X})", packet.PacketId);
 }
Exemple #10
0
 private void NetworkEvent_Close(IOEventResult result)
 {
     EndPoint ep = result.Sender as IPEndPoint;
     Logger.Warn("Client closed.");
 }
Exemple #11
0
 private void OnClosed(IOEventResult result)
 {
     Logger.Info("[{0}] Closed", SessionId);
 }