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