MCPcopy Create free account
hub / github.com/defold/defold / SendAll

Function SendAll

engine/dlib/src/test/test_sslsocket.cpp:63–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63static void SendAll(dmSSLSocket::Socket ssl_socket, const char* buffer, uint32_t length)
64{
65 uint32_t total_sent = 0;
66 uint64_t start = dmTime::GetMonotonicTime();
67 while (total_sent < length)
68 {
69 int sent = 0;
70 dmSocket::Result result = dmSSLSocket::Send(ssl_socket, buffer + total_sent, length - total_sent, &sent);
71 if (result == dmSocket::RESULT_WOULDBLOCK)
72 {
73 ASSERT_LT(dmTime::GetMonotonicTime() - start, 5 * 1000000ULL);
74 dmTime::Sleep(1000);
75 continue;
76 }
77
78 ASSERT_EQ(dmSocket::RESULT_OK, result);
79 ASSERT_GT(sent, 0);
80 total_sent += sent;
81 }
82}
83
84static void SendString(dmSSLSocket::Socket ssl_socket, const char* buffer)
85{

Callers 1

SendStringFunction · 0.70

Calls 3

GetMonotonicTimeFunction · 0.50
SendFunction · 0.50
SleepFunction · 0.50

Tested by

no test coverage detected