Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
bugfixing do find the existing sockets in the cache during accept()
[simgrid.git] / src / gras / Transport / sg_transport.c
index 75d2d4e..53019f5 100644 (file)
@@ -2,14 +2,13 @@
 
 /* sg_transport - SG specific functions for transport                       */
 
-/* Authors: Martin Quinson                                                  */
-/* Copyright (C) 2004 Martin Quinson.                                       */
+/* Copyright (c) 2004 Martin Quinson. All rights reserved.                  */
 
 /* This program is free software; you can redistribute it and/or modify it
  under the terms of the license (GNU LGPL) which comes with this package. */
* under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "gras/Transport/transport_private.h"
-#include <msg.h>
+#include "msg/msg.h"
 #include "gras/Virtu/virtu_sg.h"
 
 XBT_LOG_EXTERNAL_CATEGORY(transport);
@@ -32,7 +31,7 @@ gras_trp_select(double timeout,
 
   xbt_error_t errcode;
   double startTime=gras_os_time();
-  gras_procdata_t *pd=gras_procdata_get();
+  gras_trp_procdata_t pd=(gras_trp_procdata_t)gras_libdata_get("gras_trp");
   gras_trp_sg_sock_data_t *sockdata;
   gras_trp_plugin_t *trp;
 
@@ -56,10 +55,10 @@ gras_trp_select(double timeout,
        DEBUG1("Consider %p as outgoing socket to expeditor",sock_iter);
        sockdata = sock_iter->data;
 
-       if (sock_iter->raw || !sock_iter->outgoing)
+       if (sock_iter->meas || !sock_iter->outgoing)
          continue;
 
-       if (sockdata->from_PID == r_pid) {
+       if (sockdata->to_PID == r_pid) {
          *dst=sock_iter;
          return no_error;
        }
@@ -102,8 +101,8 @@ gras_trp_select(double timeout,
 
          xbt_dynar_foreach(remote_hd->ports, cpt, pr) {
            if (sockdata->to_chan == pr.tochan) {
-             if (pr.raw) {
-               DEBUG0("Damn, it's raw");
+             if (pr.meas) {
+               DEBUG0("Damn, it's for measurement");
                continue;
              }
 
@@ -116,10 +115,10 @@ gras_trp_select(double timeout,
            }
          }
          if ((*dst)->peer_port == -10) {
-           /* was raw */
+           /* was for measurement */
            sockdata->to_chan = -1;
          } else {
-           /* found it, don't let it override by raw */
+           /* found it, don't let it override by meas */
            break;
          }
        }
@@ -129,17 +128,20 @@ gras_trp_select(double timeout,
 
       return no_error;
     } else {
-      /*
-      DEBUG2("Select on %s@%s did not find anything yet",
+      DEBUG5("Select on %s@%s did not find anything yet at %f (waited %f of %f sec)",
             MSG_process_get_name(MSG_process_self()),
-            MSG_host_get_name(MSG_host_self()));
-      */
+            MSG_host_get_name(MSG_host_self()),
+            gras_os_time(),
+            gras_os_time()-startTime , timeout);
       /* MSG_process_sleep(1); */
       MSG_process_sleep(0.001);
     }
   } while (gras_os_time()-startTime < timeout
           || MSG_task_Iprobe((m_channel_t) pd->chan));
 
+  DEBUG0("TIMEOUT");
   return timeout_error;
 
 }