src/mrt.c
// mrt_receive1: wait for at least one byte of data over a given connection, 
// guaranteed to return data except if the connection closes (will block until
//  there is data or the connection closes)
// make sure size of buf >= MSS
wait for at least one byte of data over a given connection,
guaranteed to return data except if the connection closes (will block until
there is data or the connection closes)
make sure size of buf >= MSS
wait for at least one byte of data over a given connection guaranteed to return data except if the connection closes ( will block until there is data or the connection closes ) make sure size of buf > = MSS
void mrt_receive1(mrt_connection * conn, char * buf, int size) {  
  while (conn->active) {
    memset(buf, 0, size);
    if(!rb_empty(&conn->rb)){
      rb_pop(&conn->rb, buf);
      send_ctrl_pkt(conn->fd, &conn->addr, FLAG_ACK, conn->nextseq + conn->offset, rb_size(&conn->rb));
      return;
    }
  }
  return;
}
void mrt_receive1 ( mrt_connection * conn , char * buf , int size ) { while ( conn -> active ) { memset ( buf , 0 , size ) ; if ( ! rb_empty ( & conn -> rb ) ) { rb_pop ( & conn -> rb , buf ) ; send_ctrl_pkt ( conn -> fd , & conn -> addr , FLAG_ACK , conn -> nextseq + conn -> offset , rb_size ( & conn -> rb ) ) ; return ; } } return ; }
mrt_receive1: wait for at least one byte of data over a given connection,
guaranteed to return data except if the connection closes (will block until
there is data or the connection closes)
make sure size of buf >= MSS
mrt_receive1 : wait for at least one byte of data over a given connection guaranteed to return data except if the connection closes ( will block until there is data or the connection closes ) make sure size of buf > = MSS
// memset(buf, 0, size); // memcpy(buf, rb_pop(conn->rb)->data, MSS);