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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Andrew Deason 2011-01-27 13:13:21 -06:00 committed by Derrick Brashear
parent 15c497e90e
commit 380cc22a45

View File

@ -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); */
}