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 | f64e95a9eb9ab03240599eb9581c5a9102426a96 (patch) | |
tree | b2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /util/network | |
parent | 06361c53c4ca58f57007ea73fc399fc25664f13c (diff) | |
download | ydb-f64e95a9eb9ab03240599eb9581c5a9102426a96.tar.gz |
Restoring authorship annotation for <alexeykruglov@yandex-team.ru>. Commit 2 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 52d873137c..ac15a41f54 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 be74562f19..4f6e804346 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>(); } |