- uint32_t nextsize;
- DEBUG0("Recv the size");
- TRY(super->chunk_recv(sock,(char*)&nextsize, 4));
- data->in.size = ntohl(nextsize);
-
- VERB1("Recv the chunk (size=%d)",data->in.size);
- TRY(super->chunk_recv(sock, data->in.data, data->in.size));
- data->in.pos=0;
+ int nextsize;
+ if (gras_if_RL()) {
+ DEBUG0("Recv the size");
+ errcode=_buf_super->chunk_recv(sock,(char*)&nextsize, 4);
+ if (errcode!=no_error)
+ RAISE4(errcode,"Got '%s' while trying to get the chunk size on %p (peer = %s:%d)",
+ xbt_error_name(errcode),sock,gras_socket_peer_name(sock),gras_socket_peer_port(sock));
+ data->in.size = (int)ntohl(nextsize);
+ VERB1("Recv the chunk (size=%d)",data->in.size);
+ } else {
+ data->in.size = -1;
+ }
+
+ TRY(_buf_super->chunk_recv(sock, data->in.data, data->in.size));
+
+ if (gras_if_RL()) {
+ data->in.pos=0;
+ } else {
+ memcpy((char*)&nextsize,data->in.data,4);
+ data->in.size = nextsize+4;
+ data->in.pos=4;
+ VERB3("Got the chunk (size=%d+4 for the size ifself)='%.*s'",
+ data->in.size-4, data->in.size,data->in.data);
+ if (XBT_LOG_ISENABLED(trp_buf,xbt_log_priority_debug))
+ hexa_print("chunck received",data->in.data,data->in.size);
+ }
+