From 380cc22a45dff7e40cd50d57a56742b59ccc4952 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 27 Jan 2011 13:13:21 -0600 Subject: [PATCH] afscp: Fix -s option for writes When writing to AFS with afscp, the -s option was sleeping before any StoreData RPCs actually got issued to the fileserver. Move the sleep to after we have done one rx_Read/rx_Write, so we sleep after starting to contact the fileserver, to make sleeping while writing more consistent with sleeping while reading. Change-Id: Ib4e93b65f50cbad30d057ad7905617d00070c1a4 Reviewed-on: http://gerrit.openafs.org/3762 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/tests/afscp.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/tests/afscp.c b/src/tests/afscp.c index 08b4d65..0568439 100644 --- a/src/tests/afscp.c +++ b/src/tests/afscp.c @@ -484,14 +484,6 @@ main(int argc, char **argv) bytesremaining = ntohl(bytesremaining); } - if (sleeptime > 0) { -#ifdef AFS_PTHREAD_ENV - sleep(sleeptime); -#else - IOMGR_Sleep(sleeptime); -#endif - } - while (bytesremaining > 0) { /*printf("%d bytes remaining\n",bytesremaining); */ if (slcl) { @@ -515,6 +507,17 @@ main(int argc, char **argv) if (rx_Write(dcall, databuffer, bytes) != bytes) break; } + + if (sleeptime > 0) { +#ifdef AFS_PTHREAD_ENV + sleep(sleeptime); +#else + IOMGR_Sleep(sleeptime); +#endif + /* only sleep once */ + sleeptime = 0; + } + bytesremaining -= bytes; /*printf("%d bytes copied\n",bytes); */ } -- 1.9.4