Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
		
							parent
							
								
									53576589ce
								
							
						
					
					
						commit
						34a20e40c8
					
				
							
								
								
									
										48
									
								
								test/test-amp-t1d.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								test/test-amp-t1d.js
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,48 @@
 | 
				
			||||||
 | 
					config({
 | 
				
			||||||
 | 
					  log:{
 | 
				
			||||||
 | 
					    time:true
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  MEMPOOL:1E7,
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					port(DIR.IP('tcp://localhost'))
 | 
				
			||||||
 | 
					connect(DIR.IP('tcp://localhost:5569?secure=12:34:56:78:00:02'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// agent with high payload
 | 
				
			||||||
 | 
					function ag(options) {
 | 
				
			||||||
 | 
					  this.goto=null;
 | 
				
			||||||
 | 
					  this.root=null;
 | 
				
			||||||
 | 
					  this.data=options.data;
 | 
				
			||||||
 | 
					  this.act = {
 | 
				
			||||||
 | 
					    check: function () {
 | 
				
			||||||
 | 
					      log('Waiting');
 | 
				
			||||||
 | 
					      this.root=myNode();
 | 
				
			||||||
 | 
					      var links=link(DIR.IP('%'));
 | 
				
			||||||
 | 
					      if (links && links.length) 
 | 
				
			||||||
 | 
					        this.goto=links[0];
 | 
				
			||||||
 | 
					      else sleep(500);
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    move: function () {
 | 
				
			||||||
 | 
					      log('Going to '+this.goto);
 | 
				
			||||||
 | 
					      moveto(DIR.NODE(this.goto))
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    back: function () {
 | 
				
			||||||
 | 
					      log('Going back to '+this.root);
 | 
				
			||||||
 | 
					      moveto(DIR.NODE(this.root))      
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    end: function () {
 | 
				
			||||||
 | 
					      log('I am back. Terminating (#data='+this.data.length+')');
 | 
				
			||||||
 | 
					      kill();
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  this.trans = { check:function () { return this.goto?'move':'check' },
 | 
				
			||||||
 | 
					                 move:'back',
 | 
				
			||||||
 | 
					                 back:'end' }
 | 
				
			||||||
 | 
					  this.next = 'check';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					start()
 | 
				
			||||||
 | 
					var a1 = array(20000,Math.random);
 | 
				
			||||||
 | 
					print(create(ag,{
 | 
				
			||||||
 | 
					  data : a1 
 | 
				
			||||||
 | 
					},2))
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user