MCPcopy Create free account
hub / github.com/Kitware/CMake / setOptions

Method setOptions

Utilities/cmcppdap/src/socket.cpp:132–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 }
131
132 void setOptions() {
133 RLock l(mutex);
134 if (s == InvalidSocket) {
135 return;
136 }
137
138 int enable = 1;
139
140#if !defined(_WIN32)
141 // Prevent sockets lingering after process termination, causing
142 // reconnection issues on the same port.
143 setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&enable, sizeof(enable));
144
145 struct {
146 int l_onoff; /* linger active */
147 int l_linger; /* how many seconds to linger for */
148 } linger = {false, 0};
149 setsockopt(s, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(linger));
150#endif // !defined(_WIN32)
151
152 // Enable TCP_NODELAY.
153 // DAP usually consists of small packet requests, with small packet
154 // responses. When there are many frequent, blocking requests made,
155 // Nagle's algorithm can dramatically limit the request->response rates.
156 setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&enable, sizeof(enable));
157 }
158
159 // dap::ReaderWriter compliance
160 bool isOpen() {

Callers 2

createMethod · 0.80
acceptMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected