diff options
Diffstat (limited to 'extra/yassl/src/socket_wrapper.cpp')
-rw-r--r-- | extra/yassl/src/socket_wrapper.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp index 803f4b01249..06b403c999d 100644 --- a/extra/yassl/src/socket_wrapper.cpp +++ b/extra/yassl/src/socket_wrapper.cpp @@ -113,13 +113,22 @@ uint Socket::get_ready() const uint Socket::send(const byte* buf, unsigned int sz, int flags) const { + const byte* pos = buf; + const byte* end = pos + sz; + assert(socket_ != INVALID_SOCKET); - int sent = ::send(socket_, reinterpret_cast<const char *>(buf), sz, flags); + + while (pos != end) { + int sent = ::send(socket_, reinterpret_cast<const char *>(pos), + static_cast<int>(end - pos), flags); if (sent == -1) return 0; - return sent; + pos += sent; + } + + return sz; } |