commit ca4daf2c8d3943d46d84cc2f782fe19244af2553 Author: Mike Perry mikeperry-git@fscked.org Date: Thu Mar 10 02:19:48 2011 -0800
Add a didtimeout field to .data. --- measurements-HOWTO | 2 ++ trivsocks-client.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/measurements-HOWTO b/measurements-HOWTO index ddd014b..8fc3a24 100644 --- a/measurements-HOWTO +++ b/measurements-HOWTO @@ -168,6 +168,7 @@ formatting purposes): 1244638817 164531 1244638826 335235 84 51466 + 0
The column headers might be:
@@ -181,6 +182,7 @@ startsec startusec dataresponsesec dataresponseusec datacompletesec datacompleteusec writebytes readbytes + didtimeout
The 50kb.extradata, 1mb.extradata, and 5mb.extradata files should accumulate lines with KEY=value pairs describing the following properties: diff --git a/trivsocks-client.c b/trivsocks-client.c index 1310ff9..1c3d895 100644 --- a/trivsocks-client.c +++ b/trivsocks-client.c @@ -267,6 +267,9 @@ struct timeval datacompletetime; // After payload is complete size_t read_bytes; size_t write_bytes;
+// Did we get killed by the bash 'timeout' widget? +int didtimeout; + static void output_status_information(void) { @@ -280,7 +283,8 @@ output_status_information(void) print_time(dataresponsetime); print_time(datacompletetime);
- printf("%lu %lu\n", (unsigned long)write_bytes, (unsigned long)read_bytes); + printf("%lu %lu ", (unsigned long)write_bytes, (unsigned long)read_bytes); + printf("%d\n", didtimeout); }
/** Send a resolve request for <b>hostname</b> to the Tor listening on @@ -407,6 +411,8 @@ do_connect(const char *hostname, const char *filename, uint32_t sockshost, uint1 do_http_get(s, filename, hostname, &read_bytes, &write_bytes, &datarequesttime, &dataresponsetime, &datacompletetime);
+ didtimeout = 0; + // Output status information output_status_information();
@@ -425,6 +431,13 @@ static void termination_handler(int signum) { fprintf(stderr,"Received a timeout. Exiting.\n"); + didtimeout = 1; + + // Get when response is complete + if (gettimeofday(&datacompletetime, NULL)) { + perror("getting datacompletetime for timeout"); + } + output_status_information();
exit(1);