[PATCH wpan-tools 1/3] wpan-ping: Reduce packet recv timeout to 500ms from 2s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Under normal condistions a full length 802154 frame takes areound 18ms rtt.
Setting the timeout to 2s is way to high so we reduce it to 500ms.

Signed-off-by: Stefan Schmidt <stefan@xxxxxxxxxxxxxxx>
---
 wpan-ping/wpan-ping.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/wpan-ping/wpan-ping.c b/wpan-ping/wpan-ping.c
index c83a0ad..d3f44f1 100644
--- a/wpan-ping/wpan-ping.c
+++ b/wpan-ping/wpan-ping.c
@@ -248,9 +248,9 @@ static int measure_roundtrip(struct config *conf, int sd) {
 			conf->dst_addr, conf->pan_id, conf->packet_len);
 	buf = (unsigned char *)malloc(MAX_PAYLOAD_LEN);
 
-	/* 2 seconds packet receive timeout */
-	timeout.tv_sec = 2;
-	timeout.tv_usec = 0;
+	/* 500ms seconds packet receive timeout */
+	timeout.tv_sec = 0;
+	timeout.tv_usec = 500000;
 	setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&timeout,sizeof(struct timeval));
 
 	count = 0;
@@ -295,7 +295,7 @@ static int measure_roundtrip(struct config *conf, int sd) {
 				fprintf(stdout, "%i bytes from 0x%04x seq=%i time=%.1f ms\n", ret,
 					conf->dst_addr, (int)seq_num, (float)usec/1000);
 		} else
-			fprintf(stderr, "Hit 2s packet timeout\n");
+			fprintf(stderr, "Hit 500 ms packet timeout\n");
 	}
 
 	if (count)
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux