Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Plug a memleak
[simgrid.git] / src / amok / Bandwidth / saturate.c
index b43c60e..033227d 100644 (file)
@@ -186,7 +186,7 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
     elapsed=gras_os_time()-start;
     VERB2("elapsed %f duration %f",elapsed, duration);
 
-  } while (saturate_further && (duration!=0 && elapsed < duration));
+  } while (saturate_further && (duration==0 || elapsed < duration));
 
   bw = ((double)(packet_sent*msg_size)) / elapsed;
 
@@ -227,6 +227,7 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload){
   volatile int saturate_further = 1;
   xbt_ex_t e;
   gras_socket_t measMaster=NULL,meas=NULL;
+  gras_socket_t from=gras_msg_cb_ctx_from(ctx);
 
   int port=6000;
   while (port <= 10000 && measMaster == NULL) {
@@ -267,7 +268,10 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload){
       xbt_ex_free(e);
     }
   }
-  INFO1("Saturation stopped on %s",gras_os_myname());
+  INFO3("Saturation comming from %s:%d stopped on %s",
+       gras_socket_peer_name(from),gras_socket_peer_port(from),
+       gras_os_myname());
+
   gras_socket_close(meas);
   if (gras_if_RL()) /* On SG, accepted=master */
     gras_socket_close(measMaster); 
@@ -294,4 +298,5 @@ void amok_bw_saturate_stop(const char* from_name,unsigned int from_port,
   gras_socket_close(sock);
   if (time) *time=answer->sec;
   if (bw)   *bw  =answer->bw;
+  free(answer);
 }