MCPcopy Create free account
hub / github.com/acl-dev/acl / set_zerocopy

Method set_zerocopy

lib_acl_cpp/src/stream/socket_stream.cpp:455–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455bool socket_stream::set_zerocopy(bool yes) {
456#ifdef MSG_ZEROCOPY
457 ACL_SOCKET sock = sock_handle();
458 if (sock == ACL_SOCKET_INVALID) {
459 logger_error("invalid socket handle");
460 return false;
461 }
462
463 int on = yes ? 1 : 0;
464 if (setsockopt(sock, SOL_SOCKET, SO_ZEROCOPY, &on, sizeof(on)) != 0) {
465 logger_error("set SO_ZEROCOPY %s error %s",
466 on ? "on" : "off", last_serror());
467 return false;
468 }
469 return true;
470#else
471 (void) yes;
472 return false;
473#endif
474}
475
476bool socket_stream::wait_iocp(int ms) const {
477#ifdef MSG_ZEROCOPY

Callers 2

client_echoFunction · 0.80
runMethod · 0.80

Calls 3

setsockoptFunction · 0.85
sock_handleFunction · 0.50
last_serrorFunction · 0.50

Tested by

no test coverage detected