-/** @brief Conduct a RPC call
- *
- */
-void gras_msg_rpccall(gras_socket_t server,
- double timeOut,
- gras_msgtype_t msgtype,
- void *request, void *answer) {
+/** @brief Launch a RPC call, but do not block for the answer */
+gras_msg_cb_ctx_t
+gras_msg_rpc_async_call(gras_socket_t server,
+ double timeOut,
+ gras_msgtype_t msgtype,
+ void *request) {
+ gras_msg_cb_ctx_t ctx = xbt_new0(s_gras_msg_cb_ctx_t,1);
+
+ if (msgtype->ctn_type) {
+ xbt_assert1(request,
+ "RPC type '%s' convey a payload you must provide",
+ msgtype->name);
+ } else {
+ xbt_assert1(!request,
+ "No payload was declared for RPC type '%s'",
+ msgtype->name);
+ }
+
+ ctx->ID = last_msg_ID++;
+ ctx->expeditor = server;
+ ctx->msgtype=msgtype;
+ ctx->timeout=timeOut;
+
+ VERB4("Send to %s:%d a RPC of type '%s' (ID=%lu)",
+ gras_socket_peer_name(server),
+ gras_socket_peer_port(server),
+ msgtype->name,ctx->ID);
+
+ gras_msg_send_ext(server, e_gras_msg_kind_rpccall, ctx->ID, msgtype, request);