示例#1
0
        private PayloadData TryAsyncContinuation(Task <ArraySegment <byte> > task)
        {
            if (task.IsFaulted)
            {
                SetFailed();
            }
            var payload = new PayloadData(task.GetAwaiter().GetResult());

            payload.ThrowIfError();
            return(payload);
        }
示例#2
0
        private PayloadData TryAsyncContinuation(Task <ArraySegment <byte> > task)
        {
            if (task.IsFaulted)
            {
                SetFailed();
            }
            ArraySegment <byte> bytes;

            try
            {
                bytes = task.GetAwaiter().GetResult();
            }
            catch (MySqlException ex) when(ex.Number == (int)MySqlErrorCode.CommandTimeoutExpired)
            {
                HandleTimeout();
                throw;
            }
            var payload = new PayloadData(bytes);

            payload.ThrowIfError();
            return(payload);
        }