diff --git a/src/sync/src/syncRetrieve.c b/src/sync/src/syncRetrieve.c index be4073760dfa551878301bc3bd4f2405b12b77cf..57472851df308bd75a996d8b18e46ec7f5bab053 100644 --- a/src/sync/src/syncRetrieve.c +++ b/src/sync/src/syncRetrieve.c @@ -334,7 +334,7 @@ static int64_t syncRetrieveWal(SSyncPeer *pPeer) { break; } - code = (int32_t)taosSendFile(pPeer->syncFd, sfd, NULL, size); + code = taosSendFile(pPeer->syncFd, sfd, NULL, size); close(sfd); if (code < 0) { sError("%s, failed to send wal:%s for retrieve since %s, code:0x%" PRIx64, pPeer->id, fname, strerror(errno), code); diff --git a/src/util/inc/tsocket.h b/src/util/inc/tsocket.h index 35b591b61e007dcf6d4edc39810a60454f37c07a..b4f55169594589b83c299694723cb234bd21ed7d 100644 --- a/src/util/inc/tsocket.h +++ b/src/util/inc/tsocket.h @@ -28,7 +28,7 @@ int32_t taosReadn(SOCKET sock, char *buffer, int32_t len); int32_t taosWriteMsg(SOCKET fd, void *ptr, int32_t nbytes); int32_t taosReadMsg(SOCKET fd, void *ptr, int32_t nbytes); int32_t taosNonblockwrite(SOCKET fd, char *ptr, int32_t nbytes); -int32_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len); +int64_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len); int32_t taosSetNonblocking(SOCKET sock, int32_t on); SOCKET taosOpenUdpSocket(uint32_t localIp, uint16_t localPort); diff --git a/src/util/src/tsocket.c b/src/util/src/tsocket.c index e07587686774cb0fa6c7682daca59b400a9451ec..8911b7e8ee1bb6c3ac1ee28ceeabc80f2a8ed4ab 100644 --- a/src/util/src/tsocket.c +++ b/src/util/src/tsocket.c @@ -465,36 +465,36 @@ void tinet_ntoa(char *ipstr, uint32_t ip) { #define COPY_SIZE 32768 // sendfile shall be used -int32_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len) { +int64_t taosCopyFds(SOCKET sfd, int32_t dfd, int64_t len) { int64_t leftLen; - int32_t readLen, writeLen; + int64_t readLen, writeLen; char temp[COPY_SIZE]; leftLen = len; while (leftLen > 0) { if (leftLen < COPY_SIZE) - readLen = (int32_t)leftLen; + readLen = leftLen; else readLen = COPY_SIZE; // 4K - int32_t retLen = taosReadMsg(sfd, temp, (int32_t)readLen); + int64_t retLen = taosReadMsg(sfd, temp, (int32_t)readLen); if (readLen != retLen) { - uError("read error, readLen:%d retLen:%d len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", readLen, retLen, len, - leftLen, strerror(errno)); + uError("read error, readLen:%" PRId64 " retLen:%" PRId64 " len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", + readLen, retLen, len, leftLen, strerror(errno)); return -1; } writeLen = taosWriteMsg(dfd, temp, readLen); if (readLen != writeLen) { - uError("copy error, readLen:%d writeLen:%d len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", readLen, writeLen, - len, leftLen, strerror(errno)); + uError("copy error, readLen:%" PRId64 " writeLen:%" PRId64 " len:%" PRId64 " leftLen:%" PRId64 ", reason:%s", + readLen, writeLen, len, leftLen, strerror(errno)); return -1; } leftLen -= readLen; } - return (int32_t)len; + return len; }