private static async Task <T> WriteDirectAsync_Awaited <T>(ServerEndPoint @this, Message message, ValueTask <WriteResult> write, TaskCompletionSource <T> tcs)
        {
            var result = await write.ForAwait();

            if (result != WriteResult.Success)
            {
                var ex = @this.Multiplexer.GetException(result, message, @this);
                ConnectionMultiplexer.ThrowFailed(tcs, ex);
            }
            return(await tcs.Task.ForAwait());
        }
Example #2
0
        private async ValueTask <WriteResult> CompleteWriteAndReleaseLockAsync(LockToken lockToken, ValueTask <WriteResult> flush, Message message)
        {
            using (lockToken)
            {
                try
                {
                    var result = await flush.ForAwait();

                    UnmarkActiveMessage(message);
                    physical.SetIdle();
                    return(result);
                }
                catch (Exception ex) { return(HandleWriteException(message, ex)); }
            }
        }
Example #3
0
 private async Task <WriteResult> CompleteWriteAndReleaseLockAsync(ValueTask <WriteResult> flush, Message message)
 {
     try { return(await flush.ForAwait()); }
     catch (Exception ex) { return(HandleWriteException(message, ex)); }
     finally { ReleaseSingleWriterLock(message); }
 }