MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / send

Method send

extra/yassl/src/socket_wrapper.cpp:151–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149
150
151uint Socket::send(const byte* buf, unsigned int sz, unsigned int& written)
152{
153 const byte* pos = buf;
154 const byte* end = pos + sz;
155
156 wouldBlock_ = false;
157
158 /* Remove send()/recv() hooks once non-blocking send is implemented. */
159 while (pos != end) {
160 int sent = send_func_(ptr_, pos, static_cast<int>(end - pos));
161 if (sent == -1) {
162 if (get_lastError() == SOCKET_EWOULDBLOCK ||
163 get_lastError() == SOCKET_EAGAIN) {
164 wouldBlock_ = true; // would have blocked this time only
165 nonBlocking_ = true; // nonblocking, win32 only way to tell
166 return 0;
167 }
168 return static_cast<uint>(-1);
169 }
170 pos += sent;
171 written += sent;
172 }
173
174 return sz;
175}
176
177
178uint Socket::receive(byte* buf, unsigned int sz)

Callers 1

SendMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected