xbt_dict_foreach(dict_socket,cursor,key,data){
action = (surf_action_t)ns3_get_socket_action(data);
- action->remains = ns3_get_socket_remains(data);
+ action->remains = action->cost - ns3_get_socket_sent(data);
if(ns3_get_socket_is_finished(data) == 1){
action->finish = now;
return ns3_sim->get_remains_from_socket(socket);
}
+double ns3_get_socket_sent(void *socket){
+ return ns3_sim->get_sent_from_socket(socket);
+}
+
double ns3_get_socket_last_amount_sent(void *socket){
return ns3_sim->get_last_amount_sent_from_socket(socket);
}
XBT_PUBLIC(double) ns3_time(void);
XBT_PUBLIC(void*) ns3_get_socket_action(void *socket);
XBT_PUBLIC(double) ns3_get_socket_remains(void *socket);
+XBT_PUBLIC(double) ns3_get_socket_sent(void *socket);
XBT_PUBLIC(double) ns3_get_socket_last_amount_sent(void *socket);
XBT_PUBLIC(void) ns3_reset_socket_last_amount_sent(void *socket);
XBT_PUBLIC(char) ns3_get_socket_is_finished(void *socket);
return ((MySocket *)socket)->remaining;
}
+double NS3Sim::get_sent_from_socket(void *socket){
+ return ((MySocket *)socket)->sentBytes;
+}
+
double NS3Sim::get_last_amount_sent_from_socket(void *socket){
return ((MySocket *)socket)->last_amount_sent;
}
void simulator_start(void);
void* get_action_from_socket(void *socket);
double get_remains_from_socket(void *socket);
+ double get_sent_from_socket(void *socket);
double get_last_amount_sent_from_socket(void *socket);
void reset_last_amount_sent_from_socket(void *socket);
char get_finished(void *socket);