about summary refs log tree commit diff
path: root/src/tools/crapnet.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-11-08 14:04:16 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-11-08 14:04:16 +0000
commit94648bc304af06954b503b90d1b7d5d8f6050349 (patch)
tree3974a4d1b0f302b45623e494331d5a1cc4f37338 /src/tools/crapnet.cpp
parentaee14baf8d702ae560a8253efb6388b58c2740a7 (diff)
downloadzcatch-94648bc304af06954b503b90d1b7d5d8f6050349.tar.gz
zcatch-94648bc304af06954b503b90d1b7d5d8f6050349.zip
fixed some config options for crapnet
Diffstat (limited to 'src/tools/crapnet.cpp')
-rw-r--r--src/tools/crapnet.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/tools/crapnet.cpp b/src/tools/crapnet.cpp
index e1fe453b..f5881e3c 100644
--- a/src/tools/crapnet.cpp
+++ b/src/tools/crapnet.cpp
@@ -18,12 +18,13 @@ struct PACKET
 static PACKET *first = (PACKET *)0;
 static PACKET *last = (PACKET *)0;
 static int current_latency = 0;
-static int debug = 1;
 
-static int config_ping = 100;
-static int config_pingflux = 100;
+static int config_log = 0;
+static int config_ping = 50;
+static int config_pingflux = 15;
 static int config_pingspike = 0;
-static int config_packetloss = 0; // in percent
+static int config_packetloss = 1; // in percent
+static int config_reorder = 1;
 
 int run(int port, NETADDR dest)
 {
@@ -47,7 +48,8 @@ int run(int port, NETADDR dest)
 				
 			if((rand()%100) < config_packetloss) // drop the packet
 			{
-				dbg_msg("crapnet", "dropped packet");
+				if(config_log)
+					dbg_msg("crapnet", "dropped packet");
 				continue;
 			}
 
@@ -91,7 +93,7 @@ int run(int port, NETADDR dest)
 				}
 			}
 
-			if(debug)
+			if(config_log)
 				dbg_msg("crapnet", "<< %08d %d.%d.%d.%d:%5d (%d)", p->id, from.ip[0], from.ip[1], from.ip[2], from.ip[3], from.port, p->data_size);
 		}
 		
@@ -103,7 +105,7 @@ int run(int port, NETADDR dest)
 				PACKET *p = first;
 				char flags[] = "  ";
 
-				if((rand()%2) == 0 && first->next)
+				if(config_reorder && (rand()%2) == 0 && first->next)
 				{
 					flags[0] = 'R';
 					p = first->next;
@@ -143,7 +145,7 @@ int run(int port, NETADDR dest)
 					flags[1] = 'S';
 				}
 
-				if(debug)
+				if(config_log)
 				{
 					dbg_msg("crapnet", ">> %08d %d.%d.%d.%d:%5d (%d) %s", p->id,
 						p->send_to.ip[0], p->send_to.ip[1],