Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove useless internal functions.
[simgrid.git] / src / gras / Msg / rpc.c
index 61dc2fd..c84c605 100644 (file)
@@ -75,7 +75,7 @@ static int msgfilter_rpcID(gras_msg_t msg, void *ctx)
   gras_msg_cb_ctx_t rpc_ctx;
 
 
-  DEBUG5
+  XBT_DEBUG
       ("Filter a message of ID %lu, type '%s' and kind '%s'. Waiting for ID=%lu. %s",
        msg->ID, msg->type->name, e_gras_msg_kind_names[msg->kind], ID,
        res ? "take it" : "reject");
@@ -86,7 +86,7 @@ static int msgfilter_rpcID(gras_msg_t msg, void *ctx)
   /* Check whether it is an old answer to a message we already canceled */
   xbt_dynar_foreach(_gras_rpc_cancelled, cursor, rpc_ctx) {
     if (msg->ID == rpc_ctx->ID && msg->kind == e_gras_msg_kind_rpcanswer) {
-      VERB1
+      XBT_VERB
           ("Got an answer to the already canceled (timeouted?) RPC %ld. Ignore it (leaking the payload!).",
            msg->ID);
       xbt_dynar_cursor_rm(_gras_rpc_cancelled, &cursor);
@@ -104,11 +104,6 @@ void *gras_msg_ctx_mallocator_new_f(void)
   return xbt_new0(s_gras_msg_cb_ctx_t, 1);
 }
 
-void gras_msg_ctx_mallocator_free_f(void *ctx)
-{
-  xbt_free(ctx);
-}
-
 void gras_msg_ctx_mallocator_reset_f(void *ctx)
 {
   memset(ctx, 0, sizeof(s_gras_msg_cb_ctx_t));
@@ -123,11 +118,11 @@ gras_msg_rpc_async_call_(gras_socket_t server,
   gras_msg_cb_ctx_t ctx = xbt_mallocator_get(gras_msg_ctx_mallocator);
 
   if (msgtype->ctn_type) {
-    xbt_assert1(request,
+    xbt_assert(request,
                 "RPC type '%s' convey a payload you must provide",
                 msgtype->name);
   } else {
-    xbt_assert1(!request,
+    xbt_assert(!request,
                 "No payload was declared for RPC type '%s'",
                 msgtype->name);
   }
@@ -137,7 +132,7 @@ gras_msg_rpc_async_call_(gras_socket_t server,
   ctx->msgtype = msgtype;
   ctx->timeout = timeOut;
 
-  VERB4("Send to %s:%d a RPC of type '%s' (ID=%lu)",
+  XBT_VERB("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);
 
@@ -154,11 +149,11 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer)
   s_gras_msg_t received;
 
   if (ctx->msgtype->answer_type) {
-    xbt_assert1(answer,
+    xbt_assert(answer,
                 "Answers to RPC '%s' convey a payload you must accept",
                 ctx->msgtype->name);
   } else {
-    xbt_assert1(!answer,
+    xbt_assert(!answer,
                 "No payload was declared for answers to RPC '%s'",
                 ctx->msgtype->name);
   }
@@ -176,7 +171,7 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer)
     if (!_gras_rpc_cancelled)
       _gras_rpc_cancelled = xbt_dynar_new(sizeof(ctx), NULL);
     xbt_dynar_push(_gras_rpc_cancelled, &ctx);
-    INFO5
+    XBT_INFO
         ("canceled RPC %ld pushed onto the stack (%s from %s:%d) Reason: %s",
          ctx->ID, ctx->msgtype->name,
          gras_socket_peer_name(ctx->expeditor),
@@ -189,23 +184,23 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer)
     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)",
+    XBT_VERB("Raise a remote exception cat:%d coming 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);
+    __xbt_running_ctx_fetch()->exception.msg = e.msg;
+    __xbt_running_ctx_fetch()->exception.category = e.category;
+    __xbt_running_ctx_fetch()->exception.value = e.value;
+    __xbt_running_ctx_fetch()->exception.remote = 1;
+    __xbt_running_ctx_fetch()->exception.host = e.host;
+    __xbt_running_ctx_fetch()->exception.procname = e.procname;
+    __xbt_running_ctx_fetch()->exception.pid = e.pid;
+    __xbt_running_ctx_fetch()->exception.file = e.file;
+    __xbt_running_ctx_fetch()->exception.line = e.line;
+    __xbt_running_ctx_fetch()->exception.func = e.func;
+    __xbt_running_ctx_fetch()->exception.used = e.used;
+    __xbt_running_ctx_fetch()->exception.bt_strings = e.bt_strings;
+    memset(&__xbt_running_ctx_fetch()->exception.bt, 0,
+           sizeof(__xbt_running_ctx_fetch()->exception.bt));
+    DO_THROW(__xbt_running_ctx_fetch());
   }
   memcpy(answer, received.payl, received.payl_size);
   free(received.payl);
@@ -233,10 +228,10 @@ void gras_msg_rpccall_(gras_socket_t server,
 void gras_msg_rpcreturn(double timeOut, gras_msg_cb_ctx_t ctx,
                         void *answer)
 {
-  xbt_assert0(ctx->answer_due,
+  xbt_assert(ctx->answer_due,
               "RPC return not allowed here. Either not a RPC message or already returned a result");
   ctx->answer_due = 0;
-  DEBUG5("Return to RPC '%s' from %s:%d (tOut=%f, payl=%p)",
+  XBT_DEBUG("Return to RPC '%s' from %s:%d (tOut=%f, payl=%p)",
          ctx->msgtype->name,
          gras_socket_peer_name(ctx->expeditor),
          gras_socket_peer_port(ctx->expeditor), timeOut, answer);