diff options
author | alexeykruglov <alexeykruglov@yandex-team.ru> | 2022-02-10 16:45:38 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:38 +0300 |
commit | 06361c53c4ca58f57007ea73fc399fc25664f13c (patch) | |
tree | f5df3a0e589db8e1e30dca616e6fa2d10bf3c64a /util/network | |
parent | 94e51c602b555459333b3c6ae92476c424c930bc (diff) | |
download | ydb-06361c53c4ca58f57007ea73fc399fc25664f13c.tar.gz |
Restoring authorship annotation for <alexeykruglov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/network')
-rw-r--r-- | util/network/iovec.h | 2 | ||||
-rw-r--r-- | util/network/socket.cpp | 62 |
2 files changed, 32 insertions, 32 deletions
diff --git a/util/network/iovec.h b/util/network/iovec.h index ac15a41f54..52d873137c 100644 --- a/util/network/iovec.h +++ b/util/network/iovec.h @@ -50,7 +50,7 @@ public: return ret; } - + inline size_t Bytes() const noexcept { return Bytes(Parts_, Count_); } diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 4f6e804346..be74562f19 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -38,7 +38,7 @@ #include <util/string/cast.h> #include <util/stream/mem.h> #include <util/system/datetime.h> -#include <util/system/error.h> +#include <util/system/error.h> #include <util/memory/tempbuf.h> #include <util/generic/singleton.h> #include <util/generic/hash_set.h> @@ -782,23 +782,23 @@ public: return ret; } - + ssize_t SendV(SOCKET fd, const TPart* parts, size_t count) override { ssize_t ret = SendVImpl(fd, parts, count); - + if (ret < 0) { return ret; } - + size_t len = TContIOVector::Bytes(parts, count); - + if ((size_t)ret == len) { return ret; } - + return SendVPartial(fd, parts, count, ret); } - + inline ssize_t SendVImpl(SOCKET fd, const TPart* parts, size_t count) { return TSender < (sizeof(iovec) == sizeof(TPart)) && (offsetof(iovec, iov_base) == offsetof(TPart, buf)) && (offsetof(iovec, iov_len) == offsetof(TPart, len)) > ::SendV(fd, parts, count); } @@ -806,32 +806,32 @@ public: ssize_t SendVPartial(SOCKET fd, const TPart* constParts, size_t count, size_t written); }; -ssize_t TCommonSockOps::SendVPartial(SOCKET fd, const TPart* constParts, size_t count, size_t written) { - TTempBuf tempbuf(sizeof(TPart) * count); - TPart* parts = (TPart*)tempbuf.Data(); - - for (size_t i = 0; i < count; ++i) { - parts[i] = constParts[i]; - } - - TContIOVector vec(parts, count); - vec.Proceed(written); - - while (!vec.Complete()) { - ssize_t ret = SendVImpl(fd, vec.Parts(), vec.Count()); - +ssize_t TCommonSockOps::SendVPartial(SOCKET fd, const TPart* constParts, size_t count, size_t written) { + TTempBuf tempbuf(sizeof(TPart) * count); + TPart* parts = (TPart*)tempbuf.Data(); + + for (size_t i = 0; i < count; ++i) { + parts[i] = constParts[i]; + } + + TContIOVector vec(parts, count); + vec.Proceed(written); + + while (!vec.Complete()) { + ssize_t ret = SendVImpl(fd, vec.Parts(), vec.Count()); + if (ret < 0) { - return ret; + return ret; } - - written += ret; - - vec.Proceed((size_t)ret); - } - - return written; -} - + + written += ret; + + vec.Proceed((size_t)ret); + } + + return written; +} + static inline TSocket::TOps* GetCommonSockOps() noexcept { return Singleton<TCommonSockOps>(); } |