src/mrt.c
// given a set of connections, returns a connection in which 
// there is currently data to be received (may return no connection if there 
// is no such connection, never blocks and ensures that a mrt_receive1 call to 
// the resulting connection will not block either)
// - conns: connections being probed
// - res: memset to 0 before use, stores the resulting conn pts
// - size: the size of the conn pt array res, maximum amount of connections probed
// - rc: # of valid conns
given a set of connections, returns a connection in which
there is currently data to be received (may return no connection if there
is no such connection, never blocks and ensures that a mrt_receive1 call to
the resulting connection will not block either)
conns: connections being probed
res: memset to 0 before use, stores the resulting conn pts
size: the size of the conn pt array res, maximum amount of connections probed
rc: # of valid conns
given a set of connections returns a connection in which there is currently data to be received ( may return no connection if there is no such connection never blocks and ensures that a mrt_receive1 call to the resulting connection will not block either ) conns : connections being probed res : memset to 0 before use stores the resulting conn pts size : the size of the conn pt array res maximum amount of connections probed rc : # of valid conns
int mrt_probe(mrt_serv_conn * sc, mrt_connection ** res, int size) {
  int i;
  int rc = 0;
  for (i = 0; i < size; i++) 
    if (sc->conns[i].active && !rb_empty(&sc->conns[i].rb))
      res[rc++] = &sc->conns[i];
  return rc;
}
int mrt_probe ( mrt_serv_conn * sc , mrt_connection * * res , int size ) { int i ; int rc = 0 ; for ( i = 0 ; i < size ; i ++ ) if ( sc -> conns [ i ] . active && ! rb_empty ( & sc -> conns [ i ] . rb ) ) res [ rc ++ ] = & sc -> conns [ i ] ; return rc ; }
given a set of connections, returns a connection in which
there is currently data to be received (may return no connection if there
is no such connection, never blocks and ensures that a mrt_receive1 call to
the resulting connection will not block either)
 conns: connections being probed
 res: memset to 0 before use, stores the resulting conn pts
 size: the size of the conn pt array res, maximum amount of connections probed
 rc: # of valid conns
given a set of connections returns a connection in which there is currently data to be received ( may return no connection if there is no such connection never blocks and ensures that a mrt_receive1 call to the resulting connection will not block either ) conns : connections being probed res : memset to 0 before use stores the resulting conn pts size : the size of the conn pt array res maximum amount of connections probed rc : # of valid conns