- gras_msg_wait_ext(ctx->timeout,
- ctx->msgtype, NULL, msgfilter_rpcID, &ctx->ID,
- &received);
+ if (ctx->msgtype->answer_type) {
+ xbt_assert1(answer,
+ "Answers to RPC '%s' convey a payload you must accept",
+ ctx->msgtype->name);
+ } else {
+ xbt_assert1(!answer,
+ "No payload was declared for answers to RPC '%s'",
+ ctx->msgtype->name);
+ }
+
+ TRY {
+ /* The filter returns 1 when we eat an old RPC answer to something canceled */
+ do {
+ gras_msg_wait_ext(ctx->timeout,
+ ctx->msgtype, NULL, msgfilter_rpcID, &ctx->ID,
+ &received);
+ } while (received.ID != ctx->ID);
+
+ } CATCH(e) {
+ if (!_gras_rpc_cancelled)
+ _gras_rpc_cancelled = xbt_dynar_new(sizeof(ctx),NULL);
+ xbt_dynar_push(_gras_rpc_cancelled,&ctx);
+ INFO5("canceled RPC %ld pushed onto the stack (%s from %s:%d) Reason: %s",
+ ctx->ID,ctx->msgtype->name,
+ gras_socket_peer_name(ctx->expeditor),gras_socket_peer_port(ctx->expeditor),
+ e.msg);
+ RETHROW;
+ }
+