diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-08-16 18:40:09 +0000 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-08-31 08:31:45 +0200 |
| commit | 5499872ffffc3bf3c64fce7f52456c43687a969b (patch) | |
| tree | 16094718ed6e92b807cc87b17c9a361bbfde6567 /src | |
| parent | 251ee95294bd1554591c2a3b3d1d6428315dad52 (diff) | |
| download | ouroboros-5499872ffffc3bf3c64fce7f52456c43687a969b.tar.gz ouroboros-5499872ffffc3bf3c64fce7f52456c43687a969b.zip | |
tools: Report write error code in ocbr stats
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/ocbr/ocbr_client.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/tools/ocbr/ocbr_client.c b/src/tools/ocbr/ocbr_client.c index 36c07d43..60d4a0fc 100644 --- a/src/tools/ocbr/ocbr_client.c +++ b/src/tools/ocbr/ocbr_client.c @@ -88,10 +88,12 @@ int client_main(char * server, struct timespec start; struct timespec end; struct timespec intv = {(gap / BILLION), gap % BILLION}; - int ms; - const char * qenv; - qosspec_t qs; - qosspec_t * qsp; + int ms; + ssize_t rc; + int werr = 0; + const char * qenv; + qosspec_t qs; + qosspec_t * qsp; qsp = NULL; @@ -147,7 +149,9 @@ int client_main(char * server, ts_add(&end, &intv, &end); memcpy(buf, &seqnr, sizeof(seqnr)); - if (flow_write(fd, buf, size) < 0) { + rc = flow_write(fd, buf, size); + if (rc < 0) { + werr = (int) rc; stop = true; continue; } @@ -165,7 +169,10 @@ int client_main(char * server, } else { /* flood */ while (!stop) { clock_gettime(CLOCK_REALTIME, &end); - if (flow_write(fd, buf, size) < 0) { + + rc = flow_write(fd, buf, size); + if (rc < 0) { + werr = (int) rc; stop = true; continue; } @@ -183,6 +190,10 @@ int client_main(char * server, ms = ts_diff_ms(&end, &start); + /* Codes at or above 1000 are ouroboros errno.h values. */ + if (werr != 0) + printf("Send ended on write error %d.\n", werr); + printf("sent statistics: " "%9ld packets, %12ld bytes in %9d ms, %4.4f Mb/s\n", seqnr, seqnr * size, ms, (seqnr / (ms * 1000.0)) * size * 8.0); |
