| 453 | } |
| 454 | |
| 455 | bool 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 | |
| 476 | bool socket_stream::wait_iocp(int ms) const { |
| 477 | #ifdef MSG_ZEROCOPY |
no test coverage detected