예제 #1
0
        private async Task PollProc(CancellationToken token)
        {
            TrinityMessage poll_req = _AllocPollMsg(m_id, m_cookie);

            while (!token.IsCancellationRequested)
            {
                try
                {
                    _PollImpl(poll_req);
                    await Task.Delay(100);
                }
                catch (Exception ex)
                {
                    Log.WriteLine(LogLevel.Error, $"{nameof(TrinityClient)}: error occured during polling: {{0}}", ex.ToString());
                    await Task.Delay(100);
                }
            }
            poll_req.Dispose();
        }
        public override TrinityErrorCode RemoveCell(long cell_id)
        {
            TrinityMessage msg = new TrinityMessage(TrinityMessageType.PRESERVED_SYNC_WITH_RSP, (ushort)RequestType.RemoveCell, sizeof(long));

            *(long *)(msg.Buffer + TrinityMessage.Offset) = cell_id;

            TrinityResponse response;

            Network.Client.SynClient sc = GetClient();
            bool sendSuccess            = (TrinityErrorCode.E_SUCCESS == sc.SendMessage(msg.Buffer, msg.Size, out response));

            PutBackClient(sc);
            msg.Dispose();

            var eResult = response.ErrorCode;

            response.Dispose();

            return(sendSuccess ? eResult : TrinityErrorCode.E_NETWORK_SEND_FAILURE);
        }