4ddb5c55d4f4e8ad0375aab9bb2fad80d39b4c40 galt Mon Apr 24 16:34:06 2017 -0700 refs #17358. Improves trash file touching for multi-region custom bed regions temp files. diff --git src/lib/udc.c src/lib/udc.c index 9224e35..f2851fa 100644 --- src/lib/udc.c +++ src/lib/udc.c @@ -191,63 +191,63 @@ static void ourMustRead(struct ioStats *ioStats, int fd, void *buf, size_t size) { ioStats->numReads++; ioStats->bytesRead += size; mustReadFd(fd, buf, size); } static size_t ourFread(struct ioStats *ioStats, void *buf, size_t size, size_t nmemb, FILE *stream) { ioStats->numReads++; ioStats->bytesRead += size * nmemb; return fread(buf, size, nmemb, stream); } -static void readAndIgnore(struct ioStats *ioStats, int sd, bits64 size) +static void udcReadAndIgnore(struct ioStats *ioStats, int sd, bits64 size) /* Read size bytes from sd and return. */ { static char *buf = NULL; if (buf == NULL) buf = needMem(udcBlockSize); bits64 remaining = size, total = 0; while (remaining > 0) { bits64 chunkSize = min(remaining, udcBlockSize); ssize_t rd = ourRead(ioStats, sd, buf, chunkSize); if (rd < 0) - errnoAbort("readAndIgnore: error reading socket after %lld bytes", total); + errnoAbort("udcReadAndIgnore: error reading socket after %lld bytes", total); remaining -= rd; total += rd; } if (total < size) - errAbort("readAndIgnore: got EOF at %lld bytes (wanted %lld)", total, size); + errAbort("udcReadAndIgnore: got EOF at %lld bytes (wanted %lld)", total, size); } static int connInfoGetSocket(struct udcFile *file, char *url, bits64 offset, int size) /* If ci has an open socket and the given offset matches ci's current offset, * reuse ci->socket. Otherwise close the socket, open a new one, and update ci, * or return -1 if there is an error opening a new one. */ { struct connInfo *ci = &file->connInfo; if (ci != NULL && ci->socket > 0 && ci->offset != offset) { bits64 skipSize = (offset - ci->offset); if (skipSize > 0 && skipSize <= MAX_SKIP_TO_SAVE_RECONNECT) { verbose(4, "!! skipping %lld bytes @%lld to avoid reconnect\n", skipSize, ci->offset); - readAndIgnore(&file->ios.net, ci->socket, skipSize); + udcReadAndIgnore(&file->ios.net, ci->socket, skipSize); ci->offset = offset; file->ios.numReuse++; } else { verbose(4, "Offset mismatch (ci %lld != new %lld), reopening.\n", ci->offset, offset); mustCloseFd(&(ci->socket)); if (ci->ctrlSocket > 0) mustCloseFd(&(ci->ctrlSocket)); ZeroVar(ci); } } int sd; if (ci == NULL || ci->socket <= 0) {