@@ -88,6 +88,7 @@ module vibe.web.rpc;
88
88
import vibe.core.log ;
89
89
import vibe.core.core : Task, runTask, yield;
90
90
import vibe.core.path : InetPath;
91
+ import vibe.core.stream : isInputStream;
91
92
import vibe.data.bson;
92
93
import vibe.inet.url : URL ;
93
94
import vibe.http.router;
@@ -243,14 +244,14 @@ final class WebRPCPeerImpl(I, RootI, string method_prefix) : I
243
244
244
245
mixin (generateWebRPCPeerMethods! I());
245
246
246
- private auto performCall (alias method, PARAMS ... )(auto ref PARAMS params)
247
+ private ReturnType ! method performCall (alias method, PARAMS ... )(auto ref PARAMS params)
247
248
{
248
249
alias outparams = refOutParameterIndices! method;
249
250
alias paramnames = ParameterIdentifierTuple! method;
250
251
251
252
Bson args = Bson.emptyObject;
252
253
foreach (i, pname; ParameterIdentifierTuple! method)
253
- static if (! is (typeof (args [i]) == AuthInfo! I) && ! (ParameterStorageClassTuple! method[i] & ParameterStorageClass.out_))
254
+ static if (! is (ParameterTypeTuple ! method [i] == AuthInfo! I) && ! (ParameterStorageClassTuple! method[i] & ParameterStorageClass.out_))
254
255
args[pname] = serializeToBson(params[i]);
255
256
auto seq = m_handler.sendCall(method_prefix ~ __traits(identifier, method), args);
256
257
auto ret = m_handler.waitForResponse(seq);
@@ -259,8 +260,11 @@ final class WebRPCPeerImpl(I, RootI, string method_prefix) : I
259
260
params[pi] = ret[paramnames[pi]].deserializeBson! (PARAMS [pi]);
260
261
static if (! is (ReturnType! method == void ))
261
262
return ret[" return" ].deserializeBson! (ReturnType! method);
262
- } else static if (! is (ReturnType! method == void ))
263
+ } else static if (isInputStream! (ReturnType! method)) {
264
+ throw new Exception (" Stream type results are not yet supported" );
265
+ } else static if (! is (ReturnType! method == void )) {
263
266
return ret.deserializeBson! (ReturnType! method);
267
+ }
264
268
}
265
269
}
266
270
@@ -736,9 +740,9 @@ private final class WebSocketHandler(I) {
736
740
bret = Bson.emptyObject;
737
741
foreach (pi; outparams)
738
742
bret[paramnames[pi]] = serializeToBson(args[pi]);
739
- static if (is (typeof (ret)))
743
+ static if (is (typeof (ret)) && ! isInputStream ! ( typeof (ret)) )
740
744
bret[" return" ] = serializeToBson(ret);
741
- } else static if (is (typeof (ret))) {
745
+ } else static if (is (typeof (ret)) && ! isInputStream ! ( typeof (ret)) ) {
742
746
bret = serializeToBson(ret);
743
747
}
744
748
return bret;
0 commit comments