-void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx,
- void *answer) {
- xbt_ex_t e;
- s_gras_msg_t 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;
- }
-
- xbt_mallocator_release(gras_msg_ctx_mallocator, ctx);
- if (received.kind == e_gras_msg_kind_rpcerror) {
- xbt_ex_t e;
- memcpy(&e,received.payl,received.payl_size);
- free(received.payl);
- VERB3("Raise a remote exception cat:%d comming from %s (%s)",
- e.category, e.host, e.msg);
- __xbt_ex_ctx()->ctx_ex.msg = e.msg;
- __xbt_ex_ctx()->ctx_ex.category = e.category;
- __xbt_ex_ctx()->ctx_ex.value = e.value;
- __xbt_ex_ctx()->ctx_ex.remote = 1;
- __xbt_ex_ctx()->ctx_ex.host = e.host;
- __xbt_ex_ctx()->ctx_ex.procname = e.procname;
- __xbt_ex_ctx()->ctx_ex.pid = e.pid;
- __xbt_ex_ctx()->ctx_ex.file = e.file;
- __xbt_ex_ctx()->ctx_ex.line = e.line;
- __xbt_ex_ctx()->ctx_ex.func = e.func;
- __xbt_ex_ctx()->ctx_ex.used = e.used;
- __xbt_ex_ctx()->ctx_ex.bt_strings = e.bt_strings;
- memset(&__xbt_ex_ctx()->ctx_ex.bt,0,
- sizeof(__xbt_ex_ctx()->ctx_ex.bt));
- DO_THROW(__xbt_ex_ctx()->ctx_ex);
- }
- memcpy(answer,received.payl,received.payl_size);
- free(received.payl);
+void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer)
+{
+ xbt_ex_t e;
+ s_gras_msg_t 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;
+ }
+
+ xbt_mallocator_release(gras_msg_ctx_mallocator, ctx);
+ if (received.kind == e_gras_msg_kind_rpcerror) {
+ xbt_ex_t e;
+ memcpy(&e, received.payl, received.payl_size);
+ free(received.payl);
+ VERB3("Raise a remote exception cat:%d comming from %s (%s)",
+ e.category, e.host, e.msg);
+ __xbt_ex_ctx()->ctx_ex.msg = e.msg;
+ __xbt_ex_ctx()->ctx_ex.category = e.category;
+ __xbt_ex_ctx()->ctx_ex.value = e.value;
+ __xbt_ex_ctx()->ctx_ex.remote = 1;
+ __xbt_ex_ctx()->ctx_ex.host = e.host;
+ __xbt_ex_ctx()->ctx_ex.procname = e.procname;
+ __xbt_ex_ctx()->ctx_ex.pid = e.pid;
+ __xbt_ex_ctx()->ctx_ex.file = e.file;
+ __xbt_ex_ctx()->ctx_ex.line = e.line;
+ __xbt_ex_ctx()->ctx_ex.func = e.func;
+ __xbt_ex_ctx()->ctx_ex.used = e.used;
+ __xbt_ex_ctx()->ctx_ex.bt_strings = e.bt_strings;
+ memset(&__xbt_ex_ctx()->ctx_ex.bt, 0, sizeof(__xbt_ex_ctx()->ctx_ex.bt));
+ DO_THROW(__xbt_ex_ctx()->ctx_ex);
+ }
+ memcpy(answer, received.payl, received.payl_size);
+ free(received.payl);