MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / silkBioWrite

Function silkBioWrite

src/IO/SilkSecureFiberStreamSocketImpl.cpp:78–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78int silkBioWrite(BIO * bio, const char * buf, int len)
79{
80 auto * socket_impl = static_cast<Poco::Net::SocketImpl *>(BIO_get_data(bio));
81 const int fd = socket_impl->sockfd();
82 const uint64_t timeout_ns = timeoutNs(socket_impl->getSendTimeout());
83
84 uint64_t bytes_written = 0;
85 silk::FiberScheduler::IoFuture future;
86 iovec iov{const_cast<char *>(buf), static_cast<size_t>(len)};
87 silk::FiberScheduler::write(fd, &iov, 1, 0, &bytes_written, &future);
88
89 int r = timeout_ns > 0
90 ? silk::FiberFuture::waitWithTimeout(&future, timeout_ns)
91 : future.wait();
92
93 if (r == ETIMEDOUT)
94 {
95 future.cancel();
96 r = future.wait();
97 if (r == ECANCELED)
98 r = ETIMEDOUT;
99 }
100
101 BIO_clear_retry_flags(bio);
102
103 if (r == 0)
104 return static_cast<int>(bytes_written);
105
106 errno = r;
107 if (BIO_sock_non_fatal_error(r) || r == ETIMEDOUT)
108 BIO_set_retry_write(bio);
109 return -1;
110}
111
112long silkBioCtrl(BIO * bio, int cmd, [[maybe_unused]] long larg, void * parg) // NOLINT(google-runtime-int)
113{

Callers

nothing calls this directly

Calls 6

timeoutNsFunction · 0.85
writeFunction · 0.50
sockfdMethod · 0.45
getSendTimeoutMethod · 0.45
waitMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected