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

Method run

lib_acl_cpp/samples/socket/s3/main.cpp:14–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13protected:
14 void* run(void)
15 {
16 char* buf = (char*) malloc(dlen_);
17 memset(buf, 'X', dlen_);
18 int flags = MSG_NOSIGNAL;
19 if (zerocp_) {
20 flags |= MSG_ZEROCOPY;
21 conn_->set_zerocopy(true);
22 }
23
24 for (int i = 0; i < max_; i++)
25 {
26 if (conn_->send(buf, dlen_, flags) == -1)
27 {
28 printf("send error %s\r\n", acl::last_serror());
29 break;
30 }
31 if (zerocp_ && !conn_->wait_iocp(5000)) {
32 printf("wait result error %s\r\n", acl::last_serror());
33 break;
34 }
35 }
36
37 printf("Send over!\r\n");
38 free(buf);
39 delete conn_;
40 delete this;
41
42 return NULL;
43 }
44
45private:
46 acl::socket_stream* conn_;

Callers

nothing calls this directly

Calls 6

mallocFunction · 0.85
freeFunction · 0.85
set_zerocopyMethod · 0.80
wait_iocpMethod · 0.80
last_serrorFunction · 0.50
sendMethod · 0.45

Tested by

no test coverage detected