changeset 5:422f5e8fff85

Extend base read timeout to 100ms in spec and implementation. Reports indicate that 10ms is too short so extending the base timeout to 100ms to compensate.
author William Astle <lost@l-w.ca>
date Sun, 29 May 2016 21:59:29 -0600
parents 56f53e48ab50
children 3a4c972c92ec
files docs/protocol.txt src/lwwire.c
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/docs/protocol.txt	Sun May 29 21:50:51 2016 -0600
+++ b/docs/protocol.txt	Sun May 29 21:59:29 2016 -0600
@@ -63,12 +63,12 @@
 request and it MUST NOT initiate any usage of the requested feature unless
 it receives an ACK response from the server.
 
-If the delay between subsequent bytes in a request is greater 10
+If the delay between subsequent bytes in a request is greater 100
 milliseconds, the server MUST assume the transaction has failed and treat
 it as an unknown transaction. The client MUST implement a similar timeout
 to prevent entering into an infinite loop waiting for octets that may never
 come. The timeout on the client must be no longer than 1000 milliseconds and
-should be no shorter than 10 milliseconds. These timeouts MUST be applied to
+should be no shorter than 100 milliseconds. These timeouts MUST be applied to
 ALL octets that are part of the communication stream.
 
 Notwithstanding the above, some operations may specify a longer timeout
@@ -305,7 +305,7 @@
 bytes received.  It will then send that checksum to the server. The server
 must permit a longer timeout waiting for the checksum than is otherwise
 expected to give the remote side long enough to actually calculate the
-checksum. It is recommended that the timeout here be at least 50ms.
+checksum. It is recommended that the timeout here be at least 200ms.
 
 Upon receipt of the checksum, the server will verify that it is correct. If
 there was an error reading the sector OR the checksum does not match, the
--- a/src/lwwire.c	Sun May 29 21:50:51 2016 -0600
+++ b/src/lwwire.c	Sun May 29 21:59:29 2016 -0600
@@ -374,7 +374,7 @@
 
 /*
 Read len bytes from the input. If no bytes are available after
-10 ms, return error.
+100 ms, return error.
 
 This *may* allow a timeout longer than 10ms. However, it will
 eventually time out. In the worse case, it is more permissive
@@ -441,7 +441,7 @@
 		FD_ZERO(&fdset);
 		FD_SET(0, &fdset);
 		timeout.tv_sec = 0;
-		timeout.tv_usec = 10000 * itimeout;
+		timeout.tv_usec = 100000 * itimeout;
 		
 		rv = select(1, &fdset, NULL, NULL, &timeout);
 		if (rv < 0)