MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / ConfigSocket

Method ConfigSocket

src/network/socket_wrapper.hpp:122–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 setsockopt(sockfd_, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast<char*>(&timeout), sizeof(timeout));
121 }
122 inline void ConfigSocket() {
123 if (sockfd_ == INVALID_SOCKET) {
124 return;
125 }
126
127 if (setsockopt(sockfd_, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<const char*>(&SocketConfig::kSocketBufferSize), sizeof(SocketConfig::kSocketBufferSize)) != 0) {
128 Log::Warning("Set SO_RCVBUF failed, please increase your net.core.rmem_max to 100k at least");
129 }
130
131 if (setsockopt(sockfd_, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<const char*>(&SocketConfig::kSocketBufferSize), sizeof(SocketConfig::kSocketBufferSize)) != 0) {
132 Log::Warning("Set SO_SNDBUF failed, please increase your net.core.wmem_max to 100k at least");
133 }
134 if (setsockopt(sockfd_, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<const char*>(&SocketConfig::kNoDelay), sizeof(SocketConfig::kNoDelay)) != 0) {
135 Log::Warning("Set TCP_NODELAY failed");
136 }
137 }
138
139 inline static void Startup() {
140#if defined(_WIN32)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected