- GRAS_IN;
- size = htonl(data->out.size);
- DEBUG1("Send the size (=%d)",data->out.size);
- TRY(super->chunk_send(sock,(char*) &size, 4));
+ XBT_IN;
+ DEBUG0("Flush");
+ if (XBT_LOG_ISENABLED(trp_buf,xbt_log_priority_debug))
+ hexa_print("chunck to send",data->out.data,data->out.size);
+ if ((data->out.size - data->out.pos) == (gras_if_RL()?0:4) ) { /* 4 first bytes=size in SG mode*/
+ DEBUG2("Nothing to flush (size=%d; pos=%d)",data->out.size,data->out.pos);
+ return no_error;
+ }
+
+ size = (int)htonl(data->out.size - data->out.pos);
+ DEBUG4("%s the size (=%d) to %s:%d",(gras_if_RL()?"Send":"Embeed"),data->out.size-data->out.pos,
+ gras_socket_peer_name(sock),gras_socket_peer_port(sock));
+ if (gras_if_RL()) {
+ TRY(super->chunk_send(sock,(char*) &size, 4));
+ } else {
+ memcpy(data->out.data, &size, 4);
+ }
+