From aeb3ba13861af5829379cc2a305a2ac5fe0e5187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darko=20Juri=C4=87?= Date: Sat, 14 Oct 2017 04:26:33 +0200 Subject: [PATCH] Changing CallAsync return signatures. --- Deploy/Nuget/Build.cmd | 2 +- Samples/ServerClientSample/Client/Program.cs | 2 +- Source/WebsocketRPC/ConnectionBinders/Binder.cs | 6 +++--- Source/WebsocketRPC/ConnectionBinders/BinderBase.cs | 4 ++-- Source/WebsocketRPC/ConnectionBinders/RemoteBinder.cs | 6 +++--- Source/WebsocketRPC/Invokers/RemoteInvoker.cs | 8 +++----- Source/WebsocketRPC/RPC.cs | 4 ++-- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Deploy/Nuget/Build.cmd b/Deploy/Nuget/Build.cmd index 23e9851..e8ae4d1 100644 --- a/Deploy/Nuget/Build.cmd +++ b/Deploy/Nuget/Build.cmd @@ -4,7 +4,7 @@ :: settings set nugetPath=%cd%\..\..\.nuget -set version=0.5.1 +set version=0.8.1 set output=%cd%\bin :: Create output directory diff --git a/Samples/ServerClientSample/Client/Program.cs b/Samples/ServerClientSample/Client/Program.cs index 9fcf1ec..26a524b 100644 --- a/Samples/ServerClientSample/Client/Program.cs +++ b/Samples/ServerClientSample/Client/Program.cs @@ -37,7 +37,7 @@ static void Main(string[] args) c.OnOpen += async () => { var r = await RPC.For().CallAsync(x => x.LongRunningTask(5, 3)); - Console.WriteLine("Result: " + r.First().Result); + Console.WriteLine("Result: " + r.First()); }; }) .Wait(0); diff --git a/Source/WebsocketRPC/ConnectionBinders/Binder.cs b/Source/WebsocketRPC/ConnectionBinders/Binder.cs index 28766fc..4c77818 100644 --- a/Source/WebsocketRPC/ConnectionBinders/Binder.cs +++ b/Source/WebsocketRPC/ConnectionBinders/Binder.cs @@ -84,12 +84,12 @@ public async Task CallAsync(Expression CallAsync(Expression> functionExpression) + public async Task CallAsync(Expression> functionExpression) { - return await rInvoker.InvokeAsync(functionExpression); + await rInvoker.InvokeAsync(functionExpression); } - public async Task> CallAsync(Expression>> functionExpression) + public async Task CallAsync(Expression>> functionExpression) { return await rInvoker.InvokeAsync(functionExpression); } diff --git a/Source/WebsocketRPC/ConnectionBinders/BinderBase.cs b/Source/WebsocketRPC/ConnectionBinders/BinderBase.cs index f6698ba..d330018 100644 --- a/Source/WebsocketRPC/ConnectionBinders/BinderBase.cs +++ b/Source/WebsocketRPC/ConnectionBinders/BinderBase.cs @@ -80,7 +80,7 @@ public interface IRemoteBinder : IBinder /// /// Method getter. /// RPC task result. - Task CallAsync(Expression> functionExpression); + Task CallAsync(Expression> functionExpression); /// /// Calls the RPC method. @@ -88,7 +88,7 @@ public interface IRemoteBinder : IBinder /// Result. /// Method getter. /// RPC result. - Task> CallAsync(Expression>> functionExpression); + Task CallAsync(Expression>> functionExpression); } /// diff --git a/Source/WebsocketRPC/ConnectionBinders/RemoteBinder.cs b/Source/WebsocketRPC/ConnectionBinders/RemoteBinder.cs index e298c00..768957d 100644 --- a/Source/WebsocketRPC/ConnectionBinders/RemoteBinder.cs +++ b/Source/WebsocketRPC/ConnectionBinders/RemoteBinder.cs @@ -68,12 +68,12 @@ public async Task CallAsync(Expression CallAsync(Expression> functionExpression) + public async Task CallAsync(Expression> functionExpression) { - return await rInvoker.InvokeAsync(functionExpression); + await rInvoker.InvokeAsync(functionExpression); } - public async Task> CallAsync(Expression>> functionExpression) + public async Task CallAsync(Expression>> functionExpression) { return await rInvoker.InvokeAsync(functionExpression); } diff --git a/Source/WebsocketRPC/Invokers/RemoteInvoker.cs b/Source/WebsocketRPC/Invokers/RemoteInvoker.cs index eb0adde..d4f4236 100644 --- a/Source/WebsocketRPC/Invokers/RemoteInvoker.cs +++ b/Source/WebsocketRPC/Invokers/RemoteInvoker.cs @@ -105,18 +105,16 @@ public async Task InvokeAsync(Expression InvokeAsync(Expression> functionExpression) + public async Task InvokeAsync(Expression> functionExpression) { var (funcName, argVals) = getFunctionInfo(functionExpression); var response = await invokeAsync(funcName, argVals); if (response.Error != null) throw new Exception(response.Error); - - return Task.FromResult(true); } - public async Task> InvokeAsync(Expression>> functionExpression) + public async Task InvokeAsync(Expression>> functionExpression) { var (funcName, argVals) = getFunctionInfo(functionExpression); var response = await invokeAsync(funcName, argVals); @@ -125,7 +123,7 @@ public async Task> InvokeAsync(Expression invokeAsync(string name, params object[] args) diff --git a/Source/WebsocketRPC/RPC.cs b/Source/WebsocketRPC/RPC.cs index 0bb42fe..c691ea5 100644 --- a/Source/WebsocketRPC/RPC.cs +++ b/Source/WebsocketRPC/RPC.cs @@ -196,9 +196,9 @@ public static async Task CallAsync(this IEnumerableRemote binder collection. /// Method getter. /// The collection of results. - public static async Task[]> CallAsync(this IEnumerable> binders, Expression>> functionExpression) + public static async Task CallAsync(this IEnumerable> binders, Expression>> functionExpression) { - var tasks = new List>>(); + var tasks = new List>(); foreach (var b in binders) { var t = b.CallAsync(functionExpression);