public void nextCycle(Node lnode, int protocolID)
{
	for (int i=0; i < pid.length; i++) {
		// Select peer; exit if not found
		EpidemicProtocol lpeer = (EpidemicProtocol) lnode.getProtocol(pid[i]);
		Node rnode = lpeer.selectPeer(lnode);
		if (rnode == null ) 
			continue;
		EpidemicProtocol rpeer = (EpidemicProtocol) rnode.getProtocol(pid[i]);
	
		// Prepare request (in any case, even if the dest is crashed or the
		// message is lost)
		Message request = lpeer.prepareRequest(lnode, rnode);
	  if (request == null)
			continue;
	
		// If node is crashed, stop
		if (!rnode.isUp())
			continue;
		
		// If message is lost, stop
		if (!reliable && CommonState.r.nextFloat() < loss) 
			continue;
	
		// Prepare reply (in any case, even if the dest is crashed or the
		// message is lost)
		Message response = rpeer.prepareResponse(rnode, lnode, request);

		// Merge the request to the remote node
		rpeer.merge(rnode, lnode, request);
		
		if (response == null)
			continue;
	
		// If message is lost, stop
		if (!reliable && CommonState.r.nextFloat() < loss)
			continue;
		
		// Merge the response to the local node
		lpeer.merge(lnode, rnode, response);
	}
}